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

Back to archive index

Ray Satiro raysa****@yahoo*****
Fri Apr 20 15:45:09 JST 2018


On 4/17/2018 8:11 AM, Keith Marshall wrote:
> 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 ); }

Thanks Keith. How do you know that fseek will invalidate iob though, is
that guaranteed? I do not see it in the documentation.

Also, I am not sure why you did not get my e-mail to the mailing list. I
am BCCing you on this e-mail so you should receive two copies of it. If
not maybe there is some issue with the list that needs to be addressed.
Let me know if I can help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180420/e02a54fe/attachment.htm 



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