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


<[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> 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

Reply via email to