Jump to content

Recommended Posts

have loaded apache and php 5 on xp pro.

 

don't know why this is happening but when i write to a file, the new line (line break) '\n' character does not show up as a line break but as a square (which is the "unknown symbol" symbol)

 

here's the little tiny code from tigzag tutorials basically copy and pasted. my original application is to find all mp3's in a directory. and let the user build a .m3u playlist and handed over to an embedded windows media player.

 

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Bobby Bopper\n";
fwrite($fh, $stringData);
$stringData = "Tracy Tanner\n";
fwrite($fh, $stringData);
fclose($fh);

 

file shows up with:

 

Bobby Bopper[]Tracy Tanner[]

 

 

instead of:

 

Bobby Bopper

Tracy Tanner

 

google searches return nothing related. can't imagine anybody having this problem. Going nuts, i've done this before dont' know what i'm doing different.

 

 

I guess you are using notepad to view the file. Notepad only understands \r\n. When use \r or \n for new lines and display it in notepad all you'll get is square characters in placement of those chars. Change \n to \r\n and you'll see the new lines.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.