473,378 Members | 1,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Newline doesn't work for some reason?

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");
}

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
How come??

Ralph
Jan 29 '06 #1
0 1089

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: John Smith | last post by:
Hi all Why doesn't this seem to work? void stripnl(char *sz) { char *nl; nl = strchr(sz, '\n'); if (nl) {
149
by: Christopher Benson-Manica | last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.) strchr() is to strrchr() as strstr() is to strrstr(), but strrstr() isn't part of the standard. Why not? --...
29
by: runningdog | last post by:
Hi, I would like to be able to embed a newline in a text string. Is there any convienent notation to do this TIA Steve
1
by: Mr. Roundhill | last post by:
Hi there, I am trying to put a newline into a headertext property of a detailsview in my asp.net application. I've tried \r\n with no luck, and putting <br /> in the asp doesn't work either. ...
7
by: Alex Nordhus | last post by:
I am looking for a way to strip the blank line and the empty newline at the end of the text file. I can get the blank lines removed from the file but it always leaves the end line (which is blank)...
13
by: comp.lang.php | last post by:
Other: <input name="school_type_other" size="30" maxlength="75" value="<?php if ($_POST) echo $_POST; else echo str_replace('"', '&quot;', str_replace('\\', '', $result->school_type_other)); ...
16
by: infernon | last post by:
Hello Everyone, I am running PHP for Apache on a Windows XP machine. When I attempt to use \n in my code to generate a newline, it does not work. I've also see the other posts about using \r...
11
by: rossum | last post by:
I want to declare a const multi-line string inside a method, and I am having some problems using Environment.NewLine. I started out with: class foo { public void PrintStuff() { const...
11
by: Michael | last post by:
I'm new to PHP. I see that PHP supports the C printf function, and I've seen examples like printf("Hello world!\n"); however the newline character \n doesn't work - i.e., it does not generate an...
0
by: John Machin | last post by:
On Nov 18, 9:26 am, Robocop <btha...@physics.ucsd.eduwrote: The "extra" newline is inserted by the print statement. To see unambiguously what you've got, do print repr(line) Yes. It's part...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.