fxlibc/src/libc/stdio/fseek.c

17 lines
237 B
C

#include <stdio.h>
#include <unistd.h>
int fseek(FILE *fp, long offset, int whence)
{
if(fflush(fp) == EOF)
return -1;
off_t rc = lseek(fp->fd, offset, whence);
if(rc < 0)
return -1;
fp->fdpos = rc;
fp->eof = 0;
return 0;
}