Skip to main content
gamedev.net
🔒 Locked

set stringstream open modes

Started by Saandman Sep 18, 2005 at 1:18 PM 2 replies 600+ views
Original Post
Saandman
Saandman
Is there a way to specify new open modes for std::stringstream after it's been created? I.e. "re-create" the object with new modes.

std::stringstream(ios_base::binary | ios_base::app);

// set new modes?

________pro.gram.mer - an organism that turns caffeine into code
Fruny
Fruny
Not without at least re-creating the stream buffer. And open modes are pretty much irrelevant for a string stream.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Saandman
Saandman
Quote:
Original post by Fruny
Not without at least re-creating the stream buffer. And open modes are pretty much irrelevant for a string stream.


How would you go about re-creating the buffer? And why are the modes irrelevant?

Thanks
________pro.gram.mer - an organism that turns caffeine into code
SiCrane
SiCrane
Think about it, what do the modes mean? binary only applies to new line translations for files, app means to open to the end of the file and append there, etc. Most of the flags are only meaningful for file streams.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.