Re: DOS-textfile?

From: Date: Thu, 18 Nov 2004 04:18:33 +0000
Subject: Re: DOS-textfile?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-202312@lists.php.net to get a copy of this message
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@varupiraten.se> escribió en el mensaje news:60258.193.10.176.87.1100694096.squirrel@193.10.176.87... > 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/

« previous php.general (#202312) next »