[hatari-devel] Bug in File_Length (file.c)?

Uwe Seimet Uwe.Seimet at seimet.de
Sat Dec 19 12:48:07 CET 2009


Hi,

> That doesn't sound very portable either.

Yes, indeed. But what about fseeko:

NAME
       fseeko, ftello - seek to or report file position

SYNOPSIS
       #include <stdio.h>

       int fseeko(FILE *stream, off_t offset, int whence);

       off_t ftello(FILE *stream);

DESCRIPTION
       The  fseeko()  and  ftello()  functions  are  identical to fseek(3) and
       ftell(3) (see fseek(3)), respectively, except that the offset argument
       of  fseeko()  and the return value of ftello() is of type off_t instead
       of long.

I don't know the size of off_t on a 32 bit platform, but if it's more
than 32 bit using fseeko instead of fseek should work better.

Best regards

Uwe



More information about the hatari-devel mailing list