From ad7075db7eaf29103538cb4ca7dfcbdd36d9dc85 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Fri, 26 Mar 2021 13:23:13 +0100 Subject: [PATCH] Call exit() when the file(s) passed as argument(s) can't be opened. --- src/etc/filefuncs.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/etc/filefuncs.cpp b/src/etc/filefuncs.cpp index 93d9438..7dc36f1 100644 --- a/src/etc/filefuncs.cpp +++ b/src/etc/filefuncs.cpp @@ -1,4 +1,5 @@ #include +#include 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;