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

Back to archive index

Keith Marshall keith****@users*****
Wed Apr 18 03:48:45 JST 2018


On 17/04/18 15:38, Keith Marshall wrote:
> Hmm.  Some playing with this reveals another anomaly, which may arise
> when using _lseeki64() to emulate _fseeki64(): if we call _telli64(),
> before reading any input from the stream, then the reported position
> is zero, but _ftell() reports this position as *one*.  I suspect the
> same disparity may arise, between _fseeki64() and _lseeki64().

Belay that!  The apparent discrepancy arose due to my own error:

  printf( "@%" PRId64 ": %c\n", (int64_t)ftell( foo ), fgetc( foo ) );

offers no guarantees as to whether the ftell() or the fgets() will be
evaluated first.  Evaluating them in deterministic order, with a
sequence point between, confirms that all relevant functions process
file pointers consistently.

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180417/ffb3b3a1/attachment.pgp 



More information about the MinGW-Users mailing list
Back to archive index