So if you wrote string("go wtime") + ..., it should work fine.
Of course this isn't quite true, it will only work for std::strings, string literals and character literals (which are of type char in C++), so passing an int woud probably result in compile-time error.
EDIT: using a sequence of += instead should be much better performance-wise.
So if you wrote string("go wtime") + ..., it should work fine.
Of course this isn't quite true, it will only work for std::strings, string literals and character literals (which are of type char in C++), so passing an int woud probably result in compile-time error.
EDIT: using a sequence of += instead should be much better performance-wise.
Even with += you still don't get the expected result. Using integers in a string context frequently causes trouble. Sometimes it is due to implicit type conversion rules, sometimes there are other reasons. The C++ type system is quite strict and consistent but certainly not easy to understand.
Since neither + nor += do work here (with integers involved) it is necessary to either use sprintf() or string streams.