Save a few lines in filefuncs.cpp.

This commit is contained in:
Username404-59 2021-02-19 15:49:57 +01:00
parent ccba965402
commit ea173db8f9
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 4 deletions

View File

@ -7,8 +7,7 @@ using namespace std;
string getFileContent(const string& file) string getFileContent(const string& file)
{ {
ifstream filetoParse; ifstream filetoParse;
string lineinput; string lineinput, fullinput;
string fullinput;
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");
@ -17,8 +16,7 @@ string getFileContent(const string& file)
return fullinput; return fullinput;
} }
void setOutputFileContent(const string& language, const string& file, const string& content) void setOutputFileContent(const string& language, const string& file, const string& content) {
{
static ofstream outputFile (file, ofstream::out); static ofstream outputFile (file, ofstream::out);
outputFile << content; outputFile << content;
} }