- 读取一行
char ac_text[100] = {0};
while (ifile)
{
ifile.getline(ac_text, 100);
cout << ac_text << endl;
}
- 一个字符串一个字符串的读
string str_text;
while (ifile >> str_text)
{
cout << str_text << endl;
}
char ac_text[100] = {0};
while (ifile)
{
ifile.getline(ac_text, 100);
cout << ac_text << endl;
}
string str_text;
while (ifile >> str_text)
{
cout << str_text << endl;
}