← Back to context

Comment by Dwedit

6 hours ago

Because you're way deep down the call stack in some function that happened to take in a pointer, far far away from the code that opened the file.

If that's your program design then fread is not a substitute. Because you would need to pass in the FILE* pointer to all those calls.

And what are you hoping to do in those call stacks when you find an error? Can any of that logic hope to do anything useful if it can't access this data? Let the OS handle this. crash your program and restart.