I have the following cout statement. I use char arrays because I have to pass to vsnprintf to convert variable argument list and store in Msg
cout
vsnprintf
Msg
You can use std::stringstream
http://www.cplusplus.com/reference/iostream/stringstream/