On Mon, Apr 27, 2009 at 02:17:01PM +0800, Zhou Zongyi wrote: > +#ifdef _WIN32 > + if (GetFileType((HANDLE)_get_osfhandle(_fileno(fp))) != FILE_TYPE_DISK || fseek(fp, 0, SEEK_SET) != 0) > +#else > if (fseek(fp, 0, SEEK_SET) != 0) > +#endif I assume you tried just adding "|| ftell(fp)" ?