Can you try open the file in 'binary' mode? IE. fopen('/temp/newline.txt, 'rb'); ?
- Markus On Fri, Oct 26, 2001 at 01:44:22AM -0000, [EMAIL PROTECTED] wrote : > ID: 13832 > User updated by: [EMAIL PROTECTED] > Reported By: [EMAIL PROTECTED] > Status: Open > Bug Type: Filesystem function related > Operating System: Windows 2000 Professional > PHP Version: 4.0.6 > New Comment: > > This bug is probably related to bug number #6023 ("Problem with either fgets or >ftell in ISAPI") > > Previous Comments: > ------------------------------------------------------------------------ > > [2001-10-25 21:42:00] [EMAIL PROTECTED] > > Note: this still occurs in 4.0.6 (I think they're the same bug) > > What I did: tried to read over a file backwards using fseek(). > > What should have happened: I should be able to create an array of the last few lines >of a file, without reading the whole file. > > What did happen: for every newline fseek()ed over fread() seemed to gain a byte. > > I believe this could be a problem with the way fseek() handles new lines in Win32 >(possibly not always). fread() seems to read Win32 newlines as one byte, while >fseek() reads them as two. > > In the following example, if the file has no newlines or the newlines are in Unix >format, $buf is identical. If there are Win32 newlines, it isn't. > > <example> > $fp = fopen('/temp/newline.txt', 'r'); > > fread($fp, 5); > $buf = fread($fp, 5); > > > fclose($fp); > > $fp = fopen('/temp/newline.txt', 'r'); > > fseek($fp, 5); > $buf = fread($fp, 5); > > fclose($fp); > </example> > > ------------------------------------------------------------------------ > > > > Edit this bug report at http://bugs.php.net/?id=13832&edit=1 > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Markus Fischer, http://guru.josefine.at/~mfischer/ EMail: [EMAIL PROTECTED] PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0 -All your scripts are belong to Zend- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]