You are here: Re: [PHP] fgets fails after fopen succeeds « PHP « IT news, forums, messages
Re: [PHP] fgets fails after fopen succeeds

Posted by Richard Lynch on 05/11/05 08:18

On Tue, May 10, 2005 7:42 pm, Thomas Powell said:
> Printing $fh printed a 1.
>
> My original file mode was just "r", I changed to "r+" to see if I'd get
> permissions problems. The file handle seems to be fine. fgets just doesn't
> like it.
>
> This is an adaptation of the following code, which works fine on another
> Windows 2000/Apache setup. Irony is, the original code doesn't work when
> ported. I think I'm missing something in setup or permissions.

Hrmph.

God only knows what Windows 2K might have done with its file permissions
system (or lack thereof)...

What are the permissions settings on the files that work versus those that
don't?

Just for fun, if fgets doesn't like it, does fread like it?

Remote, but distinct, possibility: Bad hardware.

If the underlying hard drive is kerfraggled, then you *could* see the
behaviour you're getting -- The file seems to open okay, but an attempt to
actually read data conks out on a bad sector.

Can you skip the fgets section ENTIRELY and just fclose() it? Once the
handle is known to be corrupt (by a bad sector) then fclose() will
probably die, but if you don't attempt to read a bad sector, fclose()
shouldn't have much to do, and should succeed.

Certainly doing a backup and running a disk check wouldn't hurt, to
eliminate the hardware possibility.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация