RE: [Dev-C++] read numeric data in C++
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Alfred P. R. <al...@ya...> - 2005-03-11 00:07:41
|
Agreed, though that doesn't explain why the << operator doesn't append as one would expect by the analogous functionality of cout. You don't normally have to use a method call to set a string, you just use the = operator. It could be by implication though, if you can take ss.str("") to be synonymous with ss = "", if ss is a C++ string.
Further, that definitely doesn't explain why modifying the control state flags, as the clear method does, would cause the str("") method to occur. At least I'm not seeing it specifically delineated out in the documentation, and couldn't find it in the <sstream> file. It could be in another template, however, that I haven't looked in.
I'm not saying you're wrong Matthew, what I mean is that it's kind of inscrutable behavior on the part of string streams. Thanks for the lesson folks, I'll make sure to refrain from the <sstream> class whenever possible. ;^)
Mat...@Ve... wrote:
For some reason this doesn't seem quite right, guys.
If you are trying to empty a stringstream object so you can fill it wil new/different stuff just call ss.str("").
If you are trying to sync it up and write it out just call ss.flush().
HTH,
Matt
-----Original Message-----
From: dev...@li... [mailto:dev...@li...]On Behalf Of Alfred P. Reaud
Sent: Thursday, March 10, 2005 3:30 PM
To: Dev-Cpp UserList
Subject: Re: [Dev-C++] read numeric data in C++
That's interesting. The symptom makes it look like istr or i is only being set once. It's hard to tell without looking at it with a debugger....
<snip>
Alfred P. Reaud
|