各位可以帮我看一下这段代码有没有错误(刚刚接触C++的文件操作,可能错误不止一点点):
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main()
{
ifstream in("abc.txt");
for(string str,getline(in,str);){
//(具体操作);
}
return 0;
}
为什么总在getline那行代码报错呢?abc.txt文件和源代码在同级目录中。