#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream infile("data.txt");
if (!infile) {
cerr << "fail to open file!" << endl;
return -1;
}
string line;
while (getline(infile, line)) {
if (!line.empty()) {
cout << line << endl;
}
}
return 0;
}
getline() demo
最新推荐文章于 2021-11-22 10:51:42 发布