Writing stringstream contents into ofstream

前端 未结 4 832
情歌与酒
情歌与酒 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条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 01:36

    When passing a stringstream rdbuf to a stream newlines are not translated. The input text can contain \n so find replace won't work. The old code wrote to an fstream and switching it to a stringstream losses the endl translation.

提交回复
热议问题