![]() |
| ||
| Assertion Failure? I'm trying to read from a text file. Pretty simple, right? I guess not. It gives me this error message: Debug Assertion Failed! Program: F:\Debug\lab1431.exe File: fscanf.c Expression: stream != NULL For information on how your program can cause assertion failure, see the Visual C++ documentation on asserts. #include <stdio.h>(program is unfinished, but still should work). Why is it giving me this? |
| ||
| Re: Assertion Failure? close the file: fclose |
| ||
| Re: Assertion Failure? I just did that and it still comes up. I think it has to do with the opening of the file because if I remove the fscanf line, the error message doesn't come up. |
| ||
| Re: Assertion Failure? if (temp_each_day = NULL)The = in the above code should be replaced by == if what you want to do is comparision. |
| ||
| Re: Assertion Failure? since the debud assertion that fails is: Quote:
stream was expected to be NULL, it is not NULL. stream (in the FILE structure) would be NULL after the file has been closed. remember that fscanf can corrupt memory if your format specifiers are incorrect. |
| ||
| Re: Assertion Failure? Quote:
|
| ||
| Re: Assertion Failure? Quote:
a. the if block will not execute. b. fclose(NULL) will assert and an assertion wil fail on exit if fclose is not called. |
| ||
| Re: Assertion Failure? Programming brings to worst out of us... ;) You are welcome. |
| ||
| Re: Assertion Failure? Quote:
if (temp_each_day = NULL)the compiler would have given a warning for this. tip: set the warning level of the compiler to the highest available, and pay attention to the warnings. you would save yourself a great deal of effort and time. |
| All times are GMT -4. The time now is 1:57 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC