-1

I have seen in a couple of places that strstream objects are deprecated, but there are also stringstream objects. My compiler has 2 headers <strstream> and <sstream> and I don't know which is which. In light of this, which header should I use to produce more modern code?

I suspect <sstream> is the correct one because if I pull them up side-by-side I can find templates and definitions for various "stringstream" classes in it, but not in <strstream>.

Any insight would be much appreciated.

Edited by Fbody: n/a

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Fbody
1

Well MSDN says this:

The classes in <strstream> are deprecated. Consider using the classes in <sstream> instead.

And www.cplusplus.com has no mention of strstream at all, it seems to have vanished from their standard library reference documents.

It appears also that strstream uses char arrays in the underlying implementation while stringstream uses std::string, which is better, of course.

Edited by mike_2000_17: n/a

0

Thanks mike.

I started on cplusplus.com and I found links for both headers on the main reference page, but they both linked to the iostream page so that wasn't much help. A search will yield a stringstream page, but doesn't give the header name.

This page. has stringstream and strstream sections and mentions that "strstream classes are deprecated", but it doesn't give the header names.

edit:
Looking closer at some of the pages and diagrams on cplusplus.com, I've been able to find obscure references to <sstream> for anything stringstream-related. Thanks again.

Edited by Fbody: n/a

0

>>. A search will yield a stringstream page, but doesn't give the header name.

What you do then is click on the constructor of the object( in that page ), and it will show you
a full code, using the object at interest.

Edited by firstPerson: n/a

-1

>>. A search will yield a stringstream page, but doesn't give the header name.

What you do then is click on the constructor of the object( in that page ), and it will show you
a full code, using the object at interest.

Wow, now I really feel stupid... Worst part is I knew that too, just forgot... :P

Edited by Fbody: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.