Ive got a function in my class that writes to a log. It looks like this:
private:
// the log file
std::ofstream log;
public:
// log file function
void writeLog(std::string what) {log << what << std::endl;}
And in the constructor I create/open it this way:
system("del /F /Q SDL_Log.txt"); // delete first to make sure its new
log.open( "SDL_Log.txt", ios_base::out);
And everytime I edit something I write it to the log, then I can tell where the program died (cause thats where it stopped writing :P).
But in my log file I get this:
Screen resolution set to 640 x 480
Loading texture BackIn Main loop
Renderworld is going to render 300 tiles
ng texture 0
Line two should be "Loading texture Background" but for some reason line three begins before line two manage to finish. And only the second half of line four is written, it should say "Loading texture 0". And there should be one more line saying "Loading texture 1".
Whats wrong with the way Im handling the log file? I might add that this output isnt always what I get... sometimes its even right but I dont want that kind of chance based success when I run my program :P.