Newline doesn't work the second time...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Höglund

    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
  • s a n j a y

    #2
    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?

    Comment

    Working...