RE: [PHP-WIN] Newline in file using fputs
| From: | HKG) | Date: | Thu, 16 May 2002 13:54:49 +0000 |
| Subject: | RE: [PHP-WIN] Newline in file using fputs | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13816@lists.php.net to get a copy of this message | ||
> Congratulations on discovering the difference between windows and linux
> carriage returns. :) There are 2 types of new-line character, \r (carriage
> return, ie move the cursor back the the left hand side of the screen) and \n
> (new line, strictly interpreted as "move cursor down one line, but not
> along"). Linux quite happily accepts \n as, "new line and return cursor to
> left home" however windows needs both, \n\r (or vice versa, I'm not sure
> which). Linux fortunately will accept \n\r as a single return, so feel free to
> always put \n\r
A proper language should interpret \n into the correct CR (new line) code at the
target platform. hence: don't fiddle around with \r or \f and that shit. Just do
a TrimRight() and add on a "\n" (new line) at the end - should be enough...
By the way. Windows uses 0x0D0A as CR, eg char(13) and char(10), in that order.