By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,384 Members | 2,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,384 IT Pros & Developers. It's quick & easy.

UNIX/Windows text file compatibility

P: n/a
Hello,

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,

Olivier
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 2005-02-28, Olivier Laurent <ol******@yahoo.co.uk> wrote:
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");


Winsilly wants you to have it like fwrite($fp, "this is a new
line\r\n");

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>
Jul 17 '05 #2

P: n/a

Tim Van Wassenhove wrote:
On 2005-02-28, Olivier Laurent <ol******@yahoo.co.uk> wrote:
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");


Winsilly wants you to have it like fwrite($fp, "this is a new
line\r\n");

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>


Bedankt!

Olivier

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.