Friday, August 1, 2014

File Cannot Be Found - Lovely Crash

...instead of crashing without any error messages

std::ifstream ifs (mystr, std::ios::in | std::ios::binary);

if (ifs.is_open()) {
        cout<<"The file is read successfully! :)"<<endl;}

else {
        // show message:
        cout << "Error opening file!"<<endl;
        cout << "The file cannot be found in the given path."<<endl;
        cout<< "The program will be closed." <<endl;
        system("PAUSE") ;
        exit(EXIT_FAILURE);
 }

No comments:

Post a Comment

Setting Jupyter and Tensorflow on Google Cloud Platform

https://towardsdatascience.com/running-jupyter-notebook-in-google-cloud-platform-in-15-min-61e16da34d52