Re: fgets fails after fopen succeeds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux