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 <fstream>
|
||||||
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
string getFileContent(const string& file)
|
string getFileContent(const string& file)
|
||||||
@ -8,6 +9,9 @@ string getFileContent(const string& file)
|
|||||||
filetoParse.open(file, ios::in);
|
filetoParse.open(file, ios::in);
|
||||||
if (filetoParse.is_open()) while (getline(filetoParse, lineinput)) {
|
if (filetoParse.is_open()) while (getline(filetoParse, lineinput)) {
|
||||||
fullinput.append(lineinput + "\n");
|
fullinput.append(lineinput + "\n");
|
||||||
|
} else {
|
||||||
|
cout << "Could not open the file(s), please run as administrator." << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
filetoParse.close();
|
filetoParse.close();
|
||||||
return fullinput;
|
return fullinput;
|
||||||
|
Loading…
Reference in New Issue
Block a user