Connecting Tech Pros Worldwide Help | Site Map

Newline doesn't work the second time...

 
LinkBack Thread Tools Search this Thread
  #1  
Old January 29th, 2006, 01:05 PM
Ralph Höglund
Guest
 
Posts: n/a
Default Newline doesn't work the second time...

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 1st, 2006, 11:15 PM
s a n j a y
Guest
 
Posts: n/a
Default 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?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.