sprintf() vs stringstream

Oct 18, 2012 at 6:43pm
Hi all,
is it true that stringstream is the C++ version of sprintf()? And are there any performance differences?
Oct 19, 2012 at 2:23pm
Any answers?
Oct 19, 2012 at 3:15pm
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 Oct 19, 2012 at 3:15pm
Oct 19, 2012 at 3:15pm
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 Oct 19, 2012 at 3:16pm
Topic archived. No new replies allowed.