【发布时间】:2011-07-08 18:26:30
【问题描述】:
我有以下cout 声明。我使用 char 数组,因为我必须传递给 vsnprintf 来转换变量参数列表并存储在 Msg 中。
有什么方法可以让cout 输出到 C++ 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;
【问题讨论】: