Add basic error handling

This commit is contained in:
2020-09-30 01:15:57 +05:30
parent eb99588600
commit e2a1b493f6
5 changed files with 19 additions and 8 deletions

View File

@@ -41,11 +41,10 @@ public:
int main(int argc, const char *argv[])
{
// std::cout<<"Hello World "<<FIVE<<std::endl;
std::ifstream stream;
try{
stream.open(argv[1]);
}catch(std::exception e){
stream.open(argv[1]);
if(stream.fail()){
std::cout<<"Could not open"<<std::endl;
return 1;
}