fseek() vs. fseeko()

Sebastian Huber sebastian.huber@embedded-brains.de
Tue Jun 19 14:42:00 GMT 2012


Hello,

the fseeko() is implemented as

int
_DEFUN(fseeko, (fp, offset, whence),
        register FILE *fp _AND
        _off_t offset     _AND
        int whence)
{
   /* for now we simply cast since off_t should be long */
   return _fseek_r (_REENT, fp, (long)offset, whence);
}

thus even if sizeof(off_t) > sizeof(long) we can only use the range of long in 
fseeko().  Is this intentional?  Open group says:

http://pubs.opengroup.org/onlinepubs/009696699/functions/fseek.html

"The fseeko() function shall be equivalent to the fseek() function except that 
the offset argument is of type off_t."

Does the demanded equivalence really intend to degenerated fseeko() to 
fseek(fp, (long) offset, whence)?

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list