For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2006 > linefeed









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author linefeed
Jean Pierre Daviau

2006-05-01, 7:57 am

Hi to everyone,

I am successfully writing to a file but I cant get a linefeed : (linefeed,
LF ou 0x0A (10) en ASCII)

fopen ($fichier, "a")
......
fwrite($myBool, $text."LF")

So I am adding $text to an endless line

--
Thanks for your attention.

Jean Pierre Daviau
--
Easyphp1.8 with Apache1.3.24
and
apache.exe -v
Server version: Apache/2.0.55
Server built: Oct 9 2005 19:16:56
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
http://www.jeanpierredaviau.com


John Murtari

2006-05-01, 6:58 pm

"Jean Pierre Daviau" <Once@WasEno.ugh> writes:

>
> I am successfully writing to a file but I cant get a linefeed : (linefeed,
> LF ou 0x0A (10) en ASCII)
>
> fopen ($fichier, "a")
> .....
> fwrite($myBool, $text."LF")
>
> So I am adding $text to an endless line


You would not use "LF", to get a newline/linefeed use:
$text."\n", use "\r" for a carriage return.

Hope this helps.

--
John
________________________________________
___________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
Jean Pierre Daviau

2006-05-01, 6:58 pm

I got it:

if(!defined ("LINEFEED"))
define ("LINEFEED", chr(10));

The following works
fwrite($myBool, $phrase.LINEFEED)


Colin McKinnon

2006-05-07, 7:01 pm

Jean Pierre Daviau wrote:

> I got it:
>
> if(!defined ("LINEFEED"))
> define ("LINEFEED", chr(10));
>
> The following works
> fwrite($myBool, $phrase.LINEFEED)


That's a really bad idea. I would have thought that as a non-english speaker
you might have some understanding of non-ascii character sets. Use "\n"
instead - it should work in a lot more places.

C.
Gleep

2006-05-07, 7:01 pm

here is what i do



// test data here
$new_content = "$data1 \n";
$new_content .= "$data2 \n";
$new_content .= "$data3 \n";
$new_content .= "the end or last line ";


// rewrite the data.txt file
$fp = @fopen($file, 'w');
$write = @fwrite($fp, $new_content);
fclose($fp);


the above code forces line feeds exactly where you want them




On Mon, 1 May 2006 08:15:05 -0400, "Jean Pierre Daviau" <Once@WasEno.ugh> wrote:

>Hi to everyone,
>
>I am successfully writing to a file but I cant get a linefeed : (linefeed,
>LF ou 0x0A (10) en ASCII)
>
> fopen ($fichier, "a")
>.....
>fwrite($myBool, $text."LF")
>
>So I am adding $text to an endless line
>
>--
>Thanks for your attention.
>
>Jean Pierre Daviau


Jean Pierre Daviau

2006-05-09, 7:58 am

Ok


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com