libc: Implement fseeko() and ftello()

This commit is contained in:
apio 2022-10-22 12:41:15 +02:00
parent 759c8a8cab
commit a4eed362b6
2 changed files with 16 additions and 0 deletions

View File

@ -63,12 +63,18 @@ extern "C"
/* Moves stream's read/write offset by offset, depending on whence. */
int fseek(FILE* stream, long offset, int whence);
/* Moves stream's read/write offset by offset, depending on whence. */
int fseeko(FILE* stream, off_t offset, int whence);
/* Moves stream's read/write offset to the offset stored in the pos structure. */
int fsetpos(FILE* stream, const fpos_t* pos);
/* Returns the current offset for stream. */
long ftell(FILE* stream);
/* Returns the current offset for stream. */
off_t ftello(FILE* stream);
/* Stores the current offset for stream in the pos structure. */
int fgetpos(FILE* stream, fpos_t* pos);

View File

@ -192,6 +192,11 @@ extern "C"
return 0;
}
int fseeko(FILE* stream, off_t offset, int whence)
{
return fseek(stream, offset, whence);
}
int fsetpos(FILE* stream, const fpos_t* pos)
{
return fseek(stream, *pos, SEEK_SET);
@ -204,6 +209,11 @@ extern "C"
// maybe? We'd have to update this value in fread() and fwrite() as well...
}
off_t ftello(FILE* stream)
{
return ftell(stream);
}
int fgetpos(FILE* stream, fpos_t* pos)
{
long result = ftell(stream);