Re: (again)Writing new lines in txt- files?=)
| From: | Alexander Skwar | Date: | Wed, 23 Jan 2002 19:37:17 +0000 |
| Subject: | Re: (again)Writing new lines in txt- files?=) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81746@lists.php.net to get a copy of this message | ||
So sprach »Mårten Andersson« am 2002-01-23 um 19:27:04 +0000 :
> 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:
askwar@charente.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 8 days 22 hours 0 minutes