diff --git a/libs/libc/include/stdio.h b/libs/libc/include/stdio.h index 65c2e106..885ce8c4 100644 --- a/libs/libc/include/stdio.h +++ b/libs/libc/include/stdio.h @@ -3,6 +3,7 @@ #include #include +#include #include @@ -28,10 +29,7 @@ extern FILE* stdin; #define EOF -1 -typedef struct -{ - long f_offset; -} fpos_t; +typedef off_t fpos_t; #ifdef __cplusplus extern "C" diff --git a/libs/libc/src/file.cpp b/libs/libc/src/file.cpp index 41a4a43c..24cf10b5 100644 --- a/libs/libc/src/file.cpp +++ b/libs/libc/src/file.cpp @@ -194,7 +194,7 @@ extern "C" int fsetpos(FILE* stream, const fpos_t* pos) { - return fseek(stream, pos->f_offset, SEEK_SET); + return fseek(stream, *pos, SEEK_SET); } long ftell(FILE* stream) @@ -208,7 +208,7 @@ extern "C" { long result = ftell(stream); if (result < 0) { return -1; } - pos->f_offset = result; + *pos = result; return 0; }