Assertion failure - Expression: stream != NULL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidgale
    New Member
    • May 2008
    • 1

    Assertion failure - Expression: stream != NULL

    I'm trying to read from a text file. It gives me this error message:

    Debug Assertion Failed!

    Program: F:\Debug\lab143 1.exe
    File: fscanf.c

    Expression: stream != NULL

    Code:
    70+ LOC Removed
    Why is it giving me this??

    Thanx for the help!!!
    Last edited by sicarie; May 26 '08, 02:00 PM. Reason: Please post only the relevant portion of code
  • arnaudk
    Contributor
    • Sep 2007
    • 425

    #2
    I didn't really look at your code, but the assertion failure indicates you are trying to read text with fscanf from a file pointer that is NULL. Usually, a file pointer is NULL because fopen returned NULL when it failed to open the file. Check the file exists and the path is correct, etc. Uncomment the section in your code above that checks for a null file pointer and you'll see what I mean.

    Later, when your code is working, don't forget to compile it with the option -DNDEBUG to disable assertion checking and speed up your code.

    Comment

    Working...