Writing stringstream contents into ofstream

前端 未结 4 843
情歌与酒
情歌与酒 2021-02-01 00:46

I\'m currently using std::ofstream as follows:

std::ofstream outFile;
outFile.open(output_file);

Then I attempt to pass a st

4条回答
  •  Happy的楠姐
    2021-02-01 01:32

    If you are using std::ostringstream and wondering why nothing get written with ss.rdbuf() then use .str() function.

    outFile << oStream.str();
    

提交回复
热议问题