-
ofstream issue.
I created an a variable for my info logger
Code:
std::ofstream FileLog;
and in the constructor of my logger I do
Code:
FileLog.open("log.txt");
And while I can add everything just fine, it doesn't actually outputs the content of FileLog until I do the following in the logger destructor.
How can I make sure that it writes to the log.txt file every time I add something to the log? I want to be able to look at the log's content even if my application crashes.
Thanks in advance.
-
Output streams must be flushed for their contents to be written to the output device.
look at std::endl it isn't just for cout'ing :D.
-
...or after each write op you can do:
-