I have already debug this down to the point I know the issue, I just do not know how to solve it.
Right now I am using:
file.open(logFile.c_str(), std::ios::out | std::ios::app);
the logFile variable works fine as long as I comment out the marked line below:
time_t rawtime;
struct tm * timeinfo;
time (&rawtime);
timeinfo = localtime (&rawtime);
logFile = "bin/";
if(_DEBUG) { logFile += "Debug/"; }
else { logFile += "Release/"; }
logFile += fileName;
if(_DEBUG) { logFile += "Debug-"; }
else { logFile += "Release-"; }
logFile += asctime(timeinfo); // Works fine with this line commented.
logFile += ".log";
So how can I get this to work right with this line uncommented?
The colon (
:) is an illegal character for file names, at least for NTFS. Try usingstrftime()instead to format a string that doesn’t include the colons.