wostringstream vs ostringstream

Preview not working (again) for me so excuse if this is a mess...

I noticed today that the following won't compile: VS doesn't like tconvert.str(""). Says "No instance of overloaded function...matches the argument list". Any ideas?

1
2
3
4
5
6
std::wostringstream tconvert;     <== wostringstream
//
//
//
tconvert.str("");                 <== won't compile
tconvert.clear(); 


but this works just fine:

1
2
3
4
5
6
std::ostringstream tconvert;    <== ostringstream
//
//
//
tconvert.str("");
tconvert.clear();



Last edited on
Try L"" instead of ""?
Preview doesn't work with an initial post, it is a well known problem.

code tags use brackets [ ], not < >.

Thanks! tconvert.str(L""); works just fine.

Fixed the [ stuff.
Fixed the [ stuff.

Ummmmm, no, you didn't. Learning to properly use code tags (and other types of tags) will make it easier for everyone to help.

http://www.cplusplus.com/articles/jEywvCM9/

http://www.cplusplus.com/articles/z13hAqkS/
Topic archived. No new replies allowed.