sepoto Posted December 9, 2010 Share Posted December 9, 2010 I'm dealing with a big file that resides on a linux server running Fedora 14. feof() is failing me. It never returns false. fgets() is also failing me. It also never returns false. How can I go about finding the end of the file exactly?Thanks. Link to comment Share on other sites More sharing options...
iwato Posted December 9, 2010 Share Posted December 9, 2010 I'm dealing with a big file that resides on a linux server running Fedora 14. feof() is failing me. It never returns false. fgets() is also failing me. It also never returns false. How can I go about finding the end of the file exactly?If you are working in a MacOS, you might try turning on auto_detect_line_endings. When turned on, PHP examines the data read by the fgets() and file() functions to see if they are using Unix, MS-Dos, or Macintosh line-ending conventions.Roddy Link to comment Share on other sites More sharing options...
iwato Posted December 9, 2010 Share Posted December 9, 2010 I'm dealing with a big file that resides on a linux server running Fedora 14. feof() is failing me. It never returns false. fgets() is also failing me. It also never returns false.As follow-up to my last entry, if a connection opened by fsockopen() is not properly closed feof() will hang.Also, hopefully you do realize that the fgets() function reads only one line at a time, and that if you want to read all the way to the end of a file using the fgets() function, you will have to loop.Finally, if you are already at the end of the file, you might want to reset the file pointer to the beginning before trying to read it.Roddy Link to comment Share on other sites More sharing options...
justsomeguy Posted December 9, 2010 Share Posted December 9, 2010 feof() is failing me. It never returns false.If it returns false that means you're not at the end of the file. If it returns true that means you're at the end. So if it never returns false, then you're always at the end. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.