【发布时间】:2011-04-25 13:43:42
【问题描述】:
每当我尝试使用 istream 打开文件时,它都不会打开(is_open() 返回 false)。是否需要放置一个特定目录才能访问它(它在项目的输出目录中)?
ifstream ifile;
ifile.open("test.txt");
if(!ifile.is_open()){
cout << "The file could not be opened." << endl;
}
cin.get();
【问题讨论】:
标签: c++ file io fstream istream