diff --git a/log.cc b/log.cc index 389ebbc..2dab293 100644 --- a/log.cc +++ b/log.cc @@ -1,5 +1,8 @@ #include +#include +#include + #include "public.h" #include "log.h" @@ -27,10 +30,16 @@ int writeToFile(string path, string line, bool incLineNum) { ofstream file; - file.open(path, ios_base::app); // open the file in append mode + + /* + * Hopefully this fixes the program messing up where the server/client + * doesn't start if the file wasn't created by a previous session. + */ + file.open(path, ios_base::out|ios_base::app); if (file.is_open()) { file << line << endl; + file.close(); // this probably would help but theres too much broken stuff // right now to be sure if (incLineNum) //{