Ok, I believe it has something to do with the dirent.h code, but I may be mistaken.
This is the function,
Code:
void X_Crypt::PurgeReports()
{
DIR *d;
dirent *dir;
std::string file;
d = opendir("C:\\C++Projects\\X_Crypt\\reports\\");
if (d)
{
while ((dir = readdir(d)) != NULL)
{
file = dir->d_name;
if ( file.substr(file.size()-4) == ".xtr" )
{
file = "C:\\C++Projects\\X_Crypt\\reports\\" + file;
remove(file.c_str());
}
}
}
closedir(d);
}
and it produces this Runtime error
Code:
This application has requested the Runtime to terminate in an unusual way.
I cant seem to find what the error is in the code. I am very thankful for any assistance you provide.
[edit]
I figured out that the error is the
Code:
if ( file.substr(file.length()-4) == ".xtr" )
, but I don't see what is wrong with the code.