I've tried a lot of times to create a logging function (using \n to go to the next line), but with no luck. Here's my logging function:
and here's how I use it:PHP Code:
#include <fstream.h>
char* szDataToLog(char* Data)
{
ofstream fout;
fout.open("log.txt");
fout << Data << "\n";
fout << flush;
fout.close();
return Data;
}
My problem is that when I do this, when I call it another time, it deletes "data" with the new text.PHP Code:
szDataToLog("data\n");
Anyone got any ideas on how to fix this?