1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

LibC: Add fseeko/ftello

This changes the signatures for FILE::seek and FILE::tell, to use
`off_t` as they use lseek internally. `fpos_t` is also redefined to use
`off_t`.

Dr. POSIX says that fpos_t is:

> A non-array type containing all information needed to specify uniquely
> every position within a file.

In practice, most *NIX typedef it to `off_t`, or a struct containing an
`off_t` and some internal state.
This commit is contained in:
Stephen Gregoratto 2020-12-27 18:49:42 +11:00 committed by Andreas Kling
parent bee1774b92
commit 1867c928a9
2 changed files with 21 additions and 7 deletions

View file

@ -55,12 +55,14 @@ extern FILE* stdin;
extern FILE* stdout;
extern FILE* stderr;
typedef long fpos_t;
typedef off_t fpos_t;
int fseek(FILE*, long offset, int whence);
int fseeko(FILE*, off_t offset, int whence);
int fgetpos(FILE*, fpos_t*);
int fsetpos(FILE*, const fpos_t*);
long ftell(FILE*);
off_t ftello(FILE*);
char* fgets(char* buffer, int size, FILE*);
int fputc(int ch, FILE*);
int fileno(FILE*);