错误检測

#include<stdlib.h>
void exit(int status);
///检測文件打开失败
std::ifstream in(file);
if(in.fail()){
    std::cerr<<"Can't open"<<file<<std::endl;
    exit(1);
}

posted @ 2018-03-21 11:13  llguanli  阅读(102)  评论(0)    收藏  举报