Call exit() when the file(s) passed as argument(s) can't be opened.
This commit is contained in:
parent
c087d8b2f0
commit
ad7075db7e
@ -1,4 +1,5 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
string getFileContent(const string& file)
|
||||
@ -8,6 +9,9 @@ string getFileContent(const string& file)
|
||||
filetoParse.open(file, ios::in);
|
||||
if (filetoParse.is_open()) while (getline(filetoParse, lineinput)) {
|
||||
fullinput.append(lineinput + "\n");
|
||||
} else {
|
||||
cout << "Could not open the file(s), please run as administrator." << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
filetoParse.close();
|
||||
return fullinput;
|
||||
|
Loading…
Reference in New Issue
Block a user