You are here: Re: Newline doesn't work always....?? « PHP Programming Language « IT news, forums, messages
Re: Newline doesn't work always....??

Posted by Ralph Hφglund on 10/17/70 11:38

Pedro Graca skrev:
> Ralph HΓΆglund wrote:
>
>>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

Thanks all, I found out that I needed to use both \r and \n to
get it working. I am slowly getting the grasp of php programming now.

>
> <snip>
>
> in what mode did you fopen the file?
>
> /* open $filename in text mode */
> $handle = fopen($filename, "wt");
>
Well, I opened it with "w", no problem with that.

I had also to trim the lines from my m3u-file to get rid of
return and newline chars.

foreach ($lines as $line_num => $line) {
echo $line;
$line = trim($line);
fwrite($handle, " <song path=\"$line\"\r\n");
}
fclose($handle);

Now I have left the extraction of the song title to be invoked
into the end of lines as title = "song.mp3">

Will be back when (if) new problems arise.

Ralph in Sweden

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация