ifstream fin("filename");
if (!fin)
{
cout << "fail to open the file" <<endl;
return -1;//或者抛出异常。
}
else
{
cout << "open the file successfully" << endl;
}
fstream 中判断是否成功打开文件 | C++中文件流(fstream)的使用方法及示例
猜你喜欢
转载自blog.csdn.net/sinat_28442665/article/details/84629941
今日推荐
周排行