【发布时间】:2012-12-17 08:32:41
【问题描述】:
我有这个代码:
static std :: ifstream s_inF(argv[j]);
std :: cin.rdbuf(s_inF.rdbuf());
我怎样才能确保它正确打开文件并且没有问题?
我的意思是我想写这样的东西:
static std :: ifstream s_inF(argv[j]);
std :: cin.rdbuf(s_inF.rdbuf());
if(.....)
{
cout << "can not open the file" << endl;
return 0;
}
...
.....
....
cin.close();
有什么建议吗?
【问题讨论】: