#include <string>
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream fin(".\\Data\\test.txt");
if (!fin)
{
cout<<"Not open the document!"<<endl;
return -1;
}
string mSentence;
while (getline(fin,mSentence))
{
cout<<mSentence<<endl;
}
system("pause");
return 0;
}
使用getline函数从文本中一行一行的读字符串
最新推荐文章于 2022-11-10 10:05:43 发布