UNIX/Windows text file compatibility

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I guess it's a bit off topic but my script is written in PHP so I
guess somebody out there could help me.

I'm facing the well known issue between windows and UNIX related OS.

The file format is crucial. The file is made on a linux box and as to
be parsed on a windows box by a commercial software (so I cannot play
with the code on that side).

I'm having a problem to mark the end of lines.
"\n" as you all know doesn't pass well on Windows.

How could I replace this one:
fwrite($fichier, "this is a new line\n");

to make it works with windows?

Thank you,


Re: UNIX/Windows text file compatibility

Quoted text here. Click to load it

Winsilly wants you to have it like fwrite($fp, "this is a new

And php has now (since 4.3.10 i believe) a magic constant PHP_EOL

Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info

Re: UNIX/Windows text file compatibility

Tim Van Wassenhove wrote:
Quoted text here. Click to load it



Site Timeline