There is a C style way and a C++ style way to convert a collection of data values to a single string.
Each way uses the input/output facilities of the language, but with the output going (ultimately) to a string rather than to standard output or a file!