【发布时间】:2012-04-15 10:05:47
【问题描述】:
我曾尝试使用以下 sn-p 代码:
int main()
{
string location_file ("test.txt");
string data;
ifstream file (location_file);
getline (file, data);
file.close();
cout << data;
return 0;
}
但这行不通。现在,如果我要使用“ifstream 文件(“test.txt”)”,它会的。为什么?到底是不是一回事?
【问题讨论】:
标签: c++ string fstream getline