Reply to Re: Newbie Question re Line Breaks

Your name:

Reply:


Posted by AlexVN on 06/18/06 20:17

Pete wrote:
> Is it OK to save the body with \r\n line breaks, or will this mess up
> reading the file later with fgets()? How does fgets() deal with \r\n line
> breaks?

Pete,

fgets does nothing with line breaks on unix/linux systems. However, it
converts line breaks on windows systems, when the file handler was
opened in text mode. Please have a look at http://php.net/fopen:
"Note: Different operating system families have different line-ending
conventions. When you write a text file and want to insert a line
break, you need to use the correct line-ending character(s) for your
operating system. ... Windows offers a text-mode translation flag ('t')
which will transparently translate \n to \r\n when working with the
file. In contrast, you can also use 'b' to force binary mode, which
will not translate your data."

Sincerely,
Alexander
http://www.alexatnet.com/

[Back to original 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

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