STD:像sprintf這樣的字符串格式我必須格式化std::string帶著sprintf并將其發送到文件流中。我該怎么做?
3 回答
慕碼人8056858
TA貢獻1803條經驗 獲得超6個贊
char buff[100]; snprintf(buff, sizeof(buff), "%s", "Hello"); std::string buffAsStdStr = buff;
std::ostringstream stringStream; stringStream << "Hello"; std::string copyOfStr = stringStream.str();
- 3 回答
- 0 關注
- 803 瀏覽
添加回答
舉報
0/150
提交
取消
