[PHP] (again)Writing new lines in txt- files?=)

2002-01-23 Thread Mårten Andersson

hello again! =)

I.m using fwrite() to write to the file. What I want is a new row i a 
textdocument after each strung I insert..

I've been told that \n should be the solution to the problem whith new 
rows i a text-document. But I am not sure that's want I wanted... =) I'll 
try to be more specific.. I want to write a new row in a text document, the 
meaning whith that is that I want to create a logfile. And It would be mutch 
easier to read it if each row is a new hit to the site.
When I inserted \n in the end of the string, it didn't created a new row 
in the text file. It only created a new row when I printed out the file. But 
I want a new row IN the textfile.. =)
=) I hope I didn't complicate this matter too mutch whith my bad english.. 
=)

Thank's folk's //M.

From: Jeff Sheltren [EMAIL PROTECTED]
To: Mårten Andersson [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP] Writing new lines in txt- files?
Date: Wed, 23 Jan 2002 09:55:28 -0800


  I want to write to a textfile, but I want a row for each string I write 
to
  the file. As it is now when I write to the file it just starts writing
where
  the last string ends..
 
  What should I do? =)

How are you writing to the file currently?  Could you send some code?  One
way that would work if you are on *NIX would be as follows:

$foo = foobar.txt;
System(echo blahblahblah  $foo);

If you are doing it some other way, why not just echo a newline before each
string you send?
$s = string you want in file;
$s2 = \n . $s;



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





--
Mårten Andersson
Loddbygatan 2
60218 Norrköping

URL: http://www.vanvett.net/marten
email: [EMAIL PROTECTED]
ICQ: 86515830


_
Hämta MSN Explorer kostnadsfritt på http://explorer.msn.se/intl.asp.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] (again)Writing new lines in txt- files?=)

2002-01-23 Thread Alexander Skwar

So sprach »Mårten Andersson« am 2002-01-23 um 19:27:04 + :
 hello again! =)
 
 I.m using fwrite() to write to the file. What I want is a new row i a 
 textdocument after each strung I insert..
 
 I've been told that \n should be the solution to the problem whith new 
 rows i a text-document. But I am not sure that's want I wanted... =) I'll 
 try to be more specific.. I want to write a new row in a text document, the 
 meaning whith that is that I want to create a logfile. And It would be 
 mutch easier to read it if each row is a new hit to the site.
 When I inserted \n in the end of the string, it didn't created a new row 
 in the text file. It only created a new row when I printed out the file. 
 But I want a new row IN the textfile.. =)
 =) I hope I didn't complicate this matter too mutch whith my bad english.. 
 =)

Uhm, so you want:

Line 1
Line 2
Line 3

Is that correct?  If it is, then \n is your answer - if you're on a Unix
system, or if you're using a text editor which understands unix line
endings.  If you're on a Mac, you should use \r instead.  And if you're
so unlucky to use Windows, you've got to use \r\n.

This means, $s=Line 1\r\nLine 2\r\nLine 3\r\n; will fill the variable
$s with a string which consists of 3 lines when printed on a Windows
system.

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.iso-top.de  | Jabber: [EMAIL PROTECTED]
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
   Uptime: 8 days 22 hours 0 minutes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]