You are here: Re: Line count/blank line issue with file(), etc. « All PHP « IT news, forums, messages
Re: Line count/blank line issue with file(), etc.

Posted by J.O. Aho on 12/28/05 04:40

Curtis wrote:
> Sorry I didn't make myself clear. I'm not simply dumping
> this to an HTML file.
>
> That should not make any difference, J.O. Please not that
> I'm only displaying the COUNT of the lines, not the lines
> themselves.
>
> The point was that file() seems to be eating THE LAST
> appended newline--it does not show up in the count.
>
> In fact, in my code I'm converting all forms/combinations of
> newline to \r, processing the stuff, then converting any \r
> that's left over at the end to \n<br /> tags, to display
> properly as both HTML source and viewed HTML.
>

--- from http://www.php.net/manual/en/function.file.php ---
Note: If you are having problems with PHP not recognizing the line endings
when reading files either on or created by a Macintosh computer, you might
want to enable the auto_detect_line_endings run-time configuration option.
--- eof ---

I _guess_ the problem here is that you convert the newline to '\r', which is
really a carrier return, move the cursor to the start of the line, what you
want to do is to move the cursor to the next line, which happens to be '\n'.
I know that Microsoft do use the '\n\r' (or is it '\r\n') for newline, but
it's quite alone about that, so better to stick with others uses or try the
trick that seems to help the other microsoft (Apple).


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация