【发布时间】:2011-12-28 08:30:16
【问题描述】:
我只是想知道,是否可以让用户在尝试使用流时输入文件的位置?
例如我想做什么:
int main()
{
ifstream instream;
string file_location;
cout << "Enter in file location: " << endl;
cin >> file_location;
instream.open(file_location);
}
所以我希望他们输入文件位置,但程序不会编译。
我得到的错误信息是:
没有匹配函数调用'std::basic_ifstream >::open(std::string&)'
【问题讨论】:
标签: parameters input stream