Hi, I have checked backwards. And as you said there was an error before that. Here is the area in which the error occures ( I think ):
Code:
fread(&temp, sizeof(int), 1, file);
if (temp > 255 || temp < 1)
{
MessageBox(NULL, "Invalid mapname", "Error", MB_OK);
return;
}
try
{
worldFileName = new char[temp]; // This line makes "new" go crazy...
}
catch (std::bad_alloc &)
{
MessageBox(NULL, "AIIEEE, out of memory", "Error", MB_OK);
}
readStr(temp, worldFileName, file);
memset(worldFileName+temp, 0, strlen(worldFileName) - temp);
MessageBox(NULL, worldFileName, "Info", MB_OK);
WE_ERROR("Testing dummy3", EH_MBERROR, mainLog);
int *dummy3 = new int; // <---- This new works
WE_ERROR("Dummy3 okay", EH_MBERROR, mainLog);
fclose(file);
TdsLoader *modelLoader = new TdsLoader; // <--- This don't, it crashes
This code is from a place where I try to read a file. I know that the file is correct since it works in debuggers. But when I run the exe, something strange seems to happen with all the strings and it looses them.
Thanks for your replies
The Wazaa