[prog] C++ stringstream or something else?

Sue Stones suzo at bigpond.net.au
Tue Apr 15 23:03:18 EST 2003


Its OK I found the answer.  I couldn't find stringstream in my book before so 
I was working on your (Roblert's) example and experimentation.

But looking again I have finally found it, and with it the suggestion of using 
ss.str() to get the whole string.

Thanks.

Next step going in the oposite direction, tokenising a string! Think I'll 
leave that for tomorrow and go to bed.

sue



On Tue, 15 Apr 2003 10:29 pm, Sue Stones wrote:
> Ok I am using stringsream and it compiles but I am not getting the output
> that I want.
>
> I have something like this
> stringstream ss;
> ss << char_star_variable << "\t" << int_variable << somefunction("returning
> a double") << std::endl;
>
> This seems to be OK but when I print it I get only the value of the first
> variable printed.  I am guessing that it is because it gets to a "\0".
>
> Can I do something like the above or am I trying to make the stringstream
> do something it isn't intended to do?  If I can do something like that how
> do I get rid of the null?  If I can't how do I deal with this situation?
>
> sue
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming



More information about the Programming mailing list