Re: [PHP] fgets() question?

2002-12-22 Thread Jason Wong
On Sunday 22 December 2002 14:18, Noel Wade wrote: > Okay, attacking my flat-file issues from the other end: > > When you use $foo = fgets($fp_file); it appears that a blank line ends up > looking exactly like a FALSE ("failed to read") return value... Is there > any way to differentiate between

[PHP] fgets() question?

2002-12-21 Thread Noel Wade
Okay, attacking my flat-file issues from the other end: When you use $foo = fgets($fp_file); it appears that a blank line ends up looking exactly like a FALSE ("failed to read") return value... Is there any way to differentiate between an empty-string read (a blank line in a flat-file) and a FAL

Re: [PHP] fgets question

2002-08-14 Thread Monte Ohrt
I don't have the option of editing the text files to work right. I want to be able to read an arbitrary text file line by line and process each one. So I suppose I could do this (?) DL Neil wrote: > Hi Monte, > > >>Hi, I have a question about fgets(), it seems to pick up an extra line >>at

Re: [PHP] fgets question

2002-08-14 Thread DL Neil
Hi Monte, > Hi, I have a question about fgets(), it seems to pick up an extra line > at the end of a text file. ... > 8\n ... > Here is the output (showing newlines as \n): > buffer is 1\n > buffer is 2\n > buffer is 3\n > buffer is 4\n > buffer is 5\n > buffer is 6\n > buffer is 7\n > buffer is

RE: [PHP] fgets question

2002-08-14 Thread Jay Blanchard
[snip] 1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A No extra newlines that I could see. >> >>1\n >>2\n >>3\n >>4\n >>5\n >>6\n >>7\n >>8\n >> >>I create this PHP program and run it: >> >>>$fd = fopen ("test","r"); >>while (!feof ($fd)) { >> $buffer = fgets($fd, 4096); >> echo "buffer is $buffer"; >>}

Re: [PHP] fgets question

2002-08-14 Thread Monte Ohrt
From: "Monte Ohrt" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, August 14, 2002 11:05 AM > Subject: [PHP] fgets question > > > >>Hi, I have a question about fgets(), it seems to pick up an extra line >>at the end of a text file.

Re: [PHP] fgets question

2002-08-14 Thread Kevin Stone
The only explaination is that 'vi' is putting an extra line in there that you're not seeing. -Kevin - Original Message - From: "Monte Ohrt" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 14, 2002 11:05 AM Subject: [PHP] fgets que

[PHP] fgets question

2002-08-14 Thread Monte Ohrt
Hi, I have a question about fgets(), it seems to pick up an extra line at the end of a text file. example, I open a new file named "test" with the vi editor and make it 8 lines long like so (showing newlines as \n): 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n I create this PHP program and run it: Here