0

I use code below to read file into string. The file is a CSV file on windows. Lines are ended by '\r\n'.

std::ifstream stream(fileName);
auto rawText = std::string(std::istreambuf_iterator<char>(stream), std::istreambuf_iterator<char>());

I notice that the '\r\n' is translated into '\n'.

Why this happens? How to keep '\r\n'?

user1633272
  • 1,797
  • 5
  • 21
  • 42

0 Answers0