У меня есть следующий оператор cout
. Я использую массивы char, потому что я должен перейти к vsnprintf
, чтобы преобразовать список аргументов переменных и сохранить в Msg
.
Есть ли способ получить cout
вывод на С++ std::string
?
char Msg[100];
char appname1[100];
char appname2[100];
char appname3[100];
// I have some logic in function which some string is assigned to Msg.
std::cout << Msg << " "<< appname1 <<":"<< appname2 << ":" << appname3 << " " << "!" << getpid() <<" " << "~" << pthread_self() << endl;