[Mingw-users] What is the right substitute for _fseeki64 / _ftelli64 for xp targets?

アーカイブの一覧に戻る

Keith Marshall keith****@users*****
Tue Apr 17 21:11:29 JST 2018


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 17/04/18 11:38, Keith Marshall wrote:
> A possibly more robust implementation of _fseeki64(), suitable for
> use on any Windows version prior to Vista, may be:
> 
> __CRT_ALIAS __int64 _fseeki64 ( FILE *__file, __int64 __pos, int
> __whence ) { fseek( __file, 0, SEEK_CUR ); return _lseeki64(
> _fileno(__file), __pos, __whence ); }

Actually, not quite correct; the return type and value should *not*
match those of _lseeki64().  It should rather be:

  __CRT_ALIAS int _fseeki64
  ( FILE *__file, __int64 __pos, int __whence )
  {
    return (fseek( __file, 0, SEEK_CUR ) == 0)
      ? (_lseeki64( _fileno(__file), __pos, __whence ) == -1LL)
        ? -1
        : 0
      : -1;
  }

and fseeko64() could simply become:

  __CRT_ALIAS int fseeko64
  ( FILE *__file, __off64_t __pos, int __whence )
  { return _fseeki64( __file, (__int64)__pos, __whence ); }

- -- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJa1eRxAAoJEMCtNsY0flo/fTMP/jLZYya+wZFrH8sLCuC+Fc3B
jlSFXXOOnX534Ch9YcsBo9jkcZ3zCJi8N1zITowBWrx1gK70ai5vw0MwTHsMcqlQ
XULl0WnQakOX1mAS4Tne0u6QTp4Kk4RKvLlNsYvPcNb+SVRVCNu97VmQ0MySpT51
wEUYviGQxuhk+ucNq3tNka1pDYIaWIHd1yd2t/8kNWZuWcw2aPP5KLFCBv4ARC5+
CVdrXrLReyUlky+3Naul/Lm3Tv4yIqTvT4RLM3ep3962O8/fO7GKi+Q6pjwHYKVD
duwp0o5IAUMsYYa3sCjXZwtFIRRYHeCtg2/RmH7CBWCXfkKcQ6LRdRqHbEjXTHl/
4k/L5f47+nGYpkoKsNOgynzV9lwiEnMXz0A/yqVjZY1J+DRdCagBbzOMcx13vAV5
9IDXg/svxaGe35gEeJTkIMTk1z4vk0H5nTJURhqoVJnQ8+f/raCedjrwHt2uZfhn
DoqkYdF1BMXGa5DcxikBUAMowbZD4gI00VYY+H+dsL+6I0eigByple+zs9Gs+lrv
RxeeS82YuKfnLIk8Y90QFdyX1ocMObpqNivatbDS10oaCArG2w49dwc0V5y/2l/o
N3bzggHuWnlD8vC9Zvd83MseHj54M9ldPUysqcTbM9em5F8KDJ+/xo2T9fV9tIf/
5QcvWUJsLN/Qp6lzby8Z
=IxDO
-----END PGP SIGNATURE-----




More information about the MinGW-Users mailing list
アーカイブの一覧に戻る