fopen returns a null pointer if the file failed to be opened. !fp evaluates to 1 if fp is a null pointer, hence if !fp evaluates to 1, the file failed to be opened.
Perhaps it would be easier to...
Type: Posts; User: laserlight
fopen returns a null pointer if the file failed to be opened. !fp evaluates to 1 if fp is a null pointer, hence if !fp evaluates to 1, the file failed to be opened.
Perhaps it would be easier to...
Ugh, I still blundered: your file was opened correctly. What's inside?
Yes (though I was confused for a moment because I think of a file not opening as "failure", not "success" :p). If the file path is correct, check file permissions.
Well...
Check that the file was opened correctly.
Do not use feof to control a loop like that; rather, use the return value of fgets.