按行读取并打印
std::string file_path = "xxxxx.txt";
std::ifstream infile(file_path);
std::string line;
while (std::getline(infile, line)) {
std::cout << line << std::endl;
}
按行读取并打印
std::string file_path = "xxxxx.txt";
std::ifstream infile(file_path);
std::string line;
while (std::getline(infile, line)) {
std::cout << line << std::endl;
}