Re: DOS-textfile?

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

 



Gustav:

  Christopher give you the differences within unix, dos [return]
characters.. you can use chop() perl function to strip carrige return of the
strings, example:

$line = chop(fgets($fileHandler, 1024));

also  you can use str_replace:

function file2unix($stringFile)
{
    return /* mac case */ str_replace("\r", "\n", /* dos case */
str_replace("\r\n/", "\n",  $stringFile));
}

$line = file2unix(fgets($fileHandler, 1024));

I can use preg_replace but can't find /(\r\n|\r)/ but maybe it finds the
alone carrige returns and not the carrige return with the newline after...


<gustav@xxxxxxxxxxxxxx> escribió en el mensaje
news:60258.193.10.176.87.1100694096.squirrel@xxxxxxxxxxxxxxxx
> Hello!
>
> I have a problem. I have som code in PHP that creates a textfile. The code
> is on a Linux-server, but when creating the textfile it is in Mac-mode. I
> can convert the textfile to DOS-textfile through TextPad (An editor), but
> I want the textfile to be in DOS-mode through the PHP-code. Can I do
> that???
>
> /Gustav Wiberg
> Swedish site:
> http://www.varupiraten.se/

-- 
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