diff --git a/src/main.cpp b/src/main.cpp index 94cf3c1..24c2bc8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "errno.h" #define FROM_INPUT_STRING false @@ -58,11 +59,19 @@ uint32_t fileSize(string fn) { return fileSize; } - +void inputFileCheck() { + if(errno == ENOENT) { + cout<< "VAsim Error: no such input file." << endl; + exit(-1); + } +} vector file2CharVector(string fn) { // open the file: std::ifstream file(fn, ios::binary); + if(file.fail()){ + inputFileCheck(); + } // get its size: std::streampos fileSize;