Read text file into string. C++ ifstream - Stack Overflow

Read text file into string. C++ ifstream - Stack Overflow

瀏覽:1358
日期:2025-06-16
To read a whole line from a file into a string, use std::getline like so: std::ifstream file("my_file"); std::string temp; std::getline(file, temp); You can do this in a loop to until the end of the file like so: std::ifstream file("my_file"); std::string...看更多