sprintf() vs stringstream

Hi all,
is it true that stringstream is the C++ version of sprintf()? And are there any performance differences?
Any answers?
Both can be used to achieve a few similar goals (e.g. locale-sensitive conversion of integer and floating-point numbers to character sequences, with some limited formatting), but there are many differences in available functionality and usage. The most important difference is that streams can serialize library and user-defined types.
"performance differences" can be examined on case-by-case basis.
Last edited on
It is not true. They do different things. That you can use stringstream to replicate some of the functionality of sprintf does not mean it's just a C++ rewrite of sprintf.
Last edited on
Topic archived. No new replies allowed.