Depends on what OS you are:

Windows: Search for \n\r (or chr(13) . chr(10))
Unix/linux: Search only for \n (or chr(13))
MAC: Search for only \r (or chr(10))

If you want to READ line by line instead of Exploding your complete content,
use this:

$myLine = fgets($myFilePointer, 1048576)

The 2 problem are that if your line is longer than 1 meg (That means a line
of 1048576 characters long without a EOL) then it will not read everything.
And the 2nd problem is the EOL (\n\r, \n or \r) is kept with the line, so
you have to also implement the code to strip out the \n and/or \r from the
end of line.

Mathieu Dumoulin

"Anthony" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> I need to read a text file by line, if I open the file and use fgets()
then
> it doesn't pick up the EOL corretly.  So I was planning on reading the
whole
> file in with fread() and then breaking it up by EOL characters.  My
question
> is, how do I do it?  What character do I search for in the string?  Anyone
> have a simple example on how to do this?  Thanks.
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to