So I was coding along working on another dll, I recompiled a dll containing the following code and suddenly my program was crashing, when i clicked the show info link on the 'send this report to Microsoft' dialog box, it said the dll which was throwing the error was msvcp90d.dll, I tracked it down to the log function (debigger said it couldn't be evaluated) :
#include "log.h" (includes <iostream>, <fstream>, <string> and has the log structure)
RupLogger::RupLogger()
{
logfile.open("log.txt", ios::out);
}
RupLogger::~RupLogger()
{
logfile.close();
}
void RupLogger::log(string msg)
{
logfile << msg + " \n";
}
So I decided to try something, the logger started below is logged correctly, but log still crashes.
RupLogger::RupLogger()
{
logfile.open("log.txt", ios::out);
logfile << "[SYS] Logger Started \n";
}
So I thought there might be some strange issue with the logfile object's access or something so I tried below:
void RupLogger::log(string msg)
{
this->logfile << "[SYS] Test Log \n";
this->logfile << msg + " \n";
}
Now this is where it gets freaky, now the debugger jumps into the ostream header and says the following is not evaluating (in bold):
Line 746:
streamsize _Pad = [B]_Ostr.width()[/B] <= 0 || [B]_Ostr.width()[/B] <= _Count
? 0 : [B]_Ostr.width()[/B] - _Count;
And um well now I'm just confused >.< and would like my program to run correctly again...