Problem: This log system does not flush the buffer on a premature exit (due to an error) from the program.
Code as follows:
Header
ModuleCode:#ifndef _LOGFILE_ #define _LOFGILE_ #include <iostream.h> #include <fstream.h> struct debugLog { ofstream OutFile; void Open(char *txt); void Write(char *txt); void Close(void); }; #endif
Code:#include "logfile.h" void debugLog::Open(char *filename) { OutFile.open(filename,ios::out); } void debugLog::Write(char *text) { OutFile<<text; } void debugLog::Close(void) { OutFile.close(); }
Any suggestions??