Re: DOS-textfile?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gustav@xxxxxxxxxxxxxx wrote:
is on a Linux-server, but when creating the textfile it is in Mac-mode.

If you mean different end of line coding, I guess you mean

dos = \r\n
*nix = \n
mac = \r

can convert the textfile to DOS-textfile through TextPad (An editor)

Good editors dont bother user with different kind of end-of-lines (even M$-wordpad do this). And they can convert between them (ex with vim ":set fileformat=dos w" to convert from linux to dos style)

A better way (not interactively, within batch files etc) is to use
a simple script to do this. Ex under Linux, install and use "flip".
Or write a simple php/perl/bash/python/whatever script to do this.

I want the textfile to be in DOS-mode through the PHP-code.

A simple way: use "\r\n" in your echo/printf statements.

Another way : use "\n" everywhere, as allways.
and just use preg_replace if you want to translate end-of-lines

PS As dos/win uses ctrl-z (^Z, ascii 26) as end-of-file code
   -- unix, linux etc dont do such stupid things --
   then be carefull to filter that char in generated txt files.
   (I had the pblm with a simple Perl script not using 'binmode')

Christophe

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux