Using a logfile is really easy especially if you use the SLogFile class form the code section. Download it and copy the SLogfile.h header file in your project's directory and add the compiled library to your project or the CPP-file if your are not using VC++.
In the project in which you want use a logfile, declare an instance of SLogFile. Don't forget to include the header file!
The next thing to do is to initialize the logfile. Do this in the part of your program where other things of your app are setup. As example I take the function InitApp():
Now your logfile is inited and ready to use. The first parameter of the member function open(..) specifies the file which the text should be written to. The second parameter tells SLogFile whether the specified logfile should be emptied or not if it allready exists.
Now place calls to SLogFile in your code where you want to know something about the status of your application. A good place is the App's setup function or critical parts of your code (like the drawing function). How to do that:
The operator << of SLogFile writes the specified text to the logfile. You could also use SLogFile::writeLine(char* buffer). If you want to write values of variables to the logfile, use something like this:
That's all. If you have problems, mail me. I'll help you out. Using a logfile is never a bad idea. It can help you finding bugs in your programs. Happy Coding!