Код:
Код: Выделить всё
std::ofstream out_file("1.txt", std::ios::binary);
out_file.write("0\r1\r\n2", 6);
out_file.close();
std::ifstream in_file("1.txt");
std::string txt{ std::istreambuf_iterator(in_file),
std::istreambuf_iterator() };
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78695226/about-writing-reading-r-n-to-from-a-file[/url]
Мобильная версия