Connecting Tech Pros Worldwide Help | Site Map

Newline doesn't work the second time...

  #1  
Old January 29th, 2006, 02:05 PM
Ralph Höglund
Guest
 
Posts: n/a
The \n I write out to an open file does not work
the second time:

$xmlstr = "<?xml version=\"1.0\"\x3F>\n";
$songstr = "<songs>\n";

fwrite($handle, "$xmlstr"); //after this I got a new line
fwrite($handle, "$songstr"); //but not after this

$lines = file("./clips/$file_name");
foreach ($lines as $line_num => $line) {

fwrite($handle, " <song path=\"$line"); //$handle is another
file that I read data from
}

The output:

<?xml version="1.0"?>
<songs> <song path="http://209.245.59.124/song.mp3

Should be:

<?xml version="1.0"?>
<songs>
<song path="http://209.245.59.124/song.mp3


What do I do wrong??

Ralph
  #2  
Old February 2nd, 2006, 12:15 AM
s a n j a y
Guest
 
Posts: n/a

re: Newline doesn't work the second time...


Ralph Höglund wrote:[color=blue]
> The \n I write out to an open file does not work
> the second time:
>
> $xmlstr = "<?xml version=\"1.0\"\x3F>\n";
> $songstr = "<songs>\n";
>
> fwrite($handle, "$xmlstr"); //after this I got a new line
> fwrite($handle, "$songstr"); //but not after this
>
> $lines = file("./clips/$file_name");
> foreach ($lines as $line_num => $line) {
>
> fwrite($handle, " <song path=\"$line"); //$handle is another file
> that I read data from
> }
>
> The output:
>
> <?xml version="1.0"?>
> <songs> <song path="http://209.245.59.124/song.mp3
>
> Should be:
>
> <?xml version="1.0"?>
> <songs>
> <song path="http://209.245.59.124/song.mp3
>
>
> What do I do wrong??
>
> Ralph[/color]

what is your platform?
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Per-type compile time constants? mario@spamnotme.it answers 3 August 13th, 2006 01:25 PM
Newline doesn't work always....?? Ralph Höglund answers 4 January 31st, 2006 02:45 PM
Newline doesn't work for some reason? Ralph Höglund answers 0 January 29th, 2006 01:55 PM
Why doesn't this work? Chris Lount answers 4 July 19th, 2005 05:54 PM