Understanding an error in C++
I have been programing with OpenGL in Visual Basic for awhile i decided that i might try C++, i played around with generel C++ for about a month and am now trying to use OpenGL. I am getting an error
"Debug Assertion Failed!"
File: Fgets.c
Line: 60
Expression: str != NULL
and gives me an Abort, Retry, Ignore box, when i hit retry it gives me the option to debug it, but that really doesnt help, What i am trying to do is read in a .obj file and make a list from it. if some one can help me figure out what this means or get me headed down the right path that would help.
June 26, 2003 04:31 AM
Well i fixed my problem, through one way. If i run the exe file on my own it runs fine, but if i run it from inside Visual C++ it gives me the error, why is that?
Post the code. You screwed up somewhere. Obviously debug error output is not included in the release executable, but the error is still there.
[edited by - haro on June 26, 2003 5:35:33 AM]
[edited by - haro on June 26, 2003 5:35:33 AM]
Debug Assertions are ways for you to catch errors when running in debug mode. Sometimes they are critical, sometimes just of interest. Since the assertion is in fgets.c, it has to do with your use of fgets or a related function. Try to track down where you use it, and make sure you''re using it right. The line "Expression: str != NULL" means that the code is checking if str!= NULL, but it turns out that str is equal to null, so it alerts you that something is wrong.
June 26, 2003 12:22 PM
do
{
fgets(string, 255, f);
} while ((string[0] == ''/'') || (string[0] == ''\n''
This is the code that i believe i s causing the error, it makes it sound like its getting nothing out of the file but i know it is
{
fgets(string, 255, f);
} while ((string[0] == ''/'') || (string[0] == ''\n''
This is the code that i believe i s causing the error, it makes it sound like its getting nothing out of the file but i know it is
Haha.. the file pointer is invalid. Make sure the file exists mate.
After you open the file, make sure its not equal to NULL. For example:
FILE* fp = fopen("c:/sex.txt", "r");
if( fp == NULL )
return 1;
[edited by - haro on June 26, 2003 2:04:30 PM]

FILE* fp = fopen("c:/sex.txt", "r");
if( fp == NULL )
return 1;
[edited by - haro on June 26, 2003 2:04:30 PM]
June 26, 2003 01:32 PM
Heh i got it, i had my file in /debug/data/ship.obj because thats where i thought it would be executed from since the exe is in there, when i moved it to just /data/ship.obj it worked fine, thats why i could run it from the exe in the /debug folder, thatnks for your help, telling me that the file didnt exist let me figure it out
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement