This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: fseek() vs. fseeko()
On Jun 19 14:54, Sebastian Huber wrote:
> It seems that fsetpos() is also limited to long:
>
> int
> _DEFUN(_fsetpos_r, (ptr, iop, pos),
> struct _reent * ptr _AND
> FILE * iop _AND
> _CONST _fpos_t * pos)
> {
> int x = _fseek_r (ptr, iop, *pos, SEEK_SET);
>
> if (x != 0)
> return 1;
> return 0;
> }
>
> I think _fseek_r() should be changed to:
>
> int
> _DEFUN(_fseek_r, (ptr, fp, offset, whence),
> struct _reent *ptr _AND
> register FILE *fp _AND
> off_t offset _AND
> int whence)
There are 64 bit capable functions available, see newlib/libc/stdio64.
I didn't implement that stuff, but I think the idea was that targets
using 64 bit off_t would use the fseeko64/ftello64/fsetpos64 functions.
In Cygwin, for instance, off_t is 64 bit. An application calling
fseeko will actually call fseeko64 by redirecting the fseeko entry
point to fseeko64.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat