how to clear a stringstream object in stl????
Ive looked to the vast reaches of the itnernet and from what I have seen there is practically absolutely no way to clear a stringstream object!!! How is that possible?
Say i have a stringstream object A, and i use it in a loop. At the beginning of every loop I want to clear A so it doesnt accumulate when I extract the string wtih A.str()
FRom what ive seen there is no way to clear the buffer, the only solution i have come up wtih is to declare A as a pointer and do A = new stringstream; before the use
and delete A after the use
is there no better way?
ByteMe95::~ByteMe95()
My S(h)ite
Umm. I might be wrong but are you allowed to:
Then again maybe I''m out to lunch on this one...
stringstream ss;//fill ss with junkss = "";
Then again maybe I''m out to lunch on this one...
Atavist: You''re right : ss = ""
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
As above, ss = "";
I asked the same question about ss = "";
It just seems wrong that there''s no clear method.
I asked the same question about ss = "";
It just seems wrong that there''s no clear method.
quote:Original post by Magmai Kai Holmlor
It just seems wrong that there''s no clear method.
doesn''t iostream::clear clears the stream io flags ?
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
ss = "" produces compiler errors, i guess you cant do that with stringstreams
ByteMe95::~ByteMe95()
My S(h)ite
ByteMe95::~ByteMe95()
My S(h)ite
quote:Original post by ByteMe95
ss = "" produces compiler errors, i guess you cant do that with stringstreams
We''re talking about std::stringstream, not strstream, right ?
Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
i am using stringstream yes
dont really know what strstream is or what the differences are
ByteMe95::~ByteMe95()
My S(h)ite
dont really know what strstream is or what the differences are
ByteMe95::~ByteMe95()
My S(h)ite
Maybe try
ZeroMemory(stringObj, sizeof(StringStream))
This may work, or it may casuse your computer to freeze, I don''t know, use at your own risk.
ZeroMemory(stringObj, sizeof(StringStream))
This may work, or it may casuse your computer to freeze, I don''t know, use at your own risk.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement