Program crashes in release, not in debug...

Started by
1 comment, last by Cor 20 years, 5 months ago
I have a project I''m working on, and at the moment it works fine in debug mode. This is using MSVC5 if that matters, on Win98. There aren''t any apparent issues. When I build a release version however it crashes. In the past this has been because of memory things that have been covered up by being in debug mode but here I''m at a loss. I had to do some detective work even though I rebuilt it with debug and program database information, because it was crashing somewhere outside of the program and I finally came to the line that causes it. fread(&hdr, sizeof(tgaheader), 1, fp); hdr is a tga header structure, declared in the function as such tgaheader hdr; fp is the file pointer and is checked for validity prior to this. If I comment that line out, the program does not crash. If anyone has any thoughts, feel free to offer any suggestions. Thanks
Advertisement
How are you checking for the validity of fp?

"Sneftel is correct, if rather vulgar." --Flarelocke
If it is not crashing in debug but it is in final, then you are probably overwriting memory with your fread. Make sure what you''re reading into has enough room for the info.

This topic is closed to new replies.

Advertisement