关于getline的一点问题
请问这段代码中flag和record的作用是什么??while (getline(indata, record))这个是什么意思?还有record的值是从哪里来的?
void msg::show_all()
{
ifstream indata("pbook.txt",ios::in);
if(!indata)
{
cerr<<"open error!"<<endl;
exit(1);
}
bool flag = true;
string record;
while (getline(indata, record))
{
if (flag)
{
cout<<ednl;
}
cout <<record <<endl;
flag = false;
}
}