fxlibc/src/libc/stdio/fsetpos.c

17 lines
235 B
C

#include <stdio.h>
#include <unistd.h>
int fsetpos(FILE *fp, fpos_t const *pos)
{
if(fflush(fp) == EOF)
return -1;
off_t rc = lseek(fp->fd, *pos, SEEK_SET);
if(rc < 0)
return -1;
fp->fdpos = *pos;
fp->eof = 0;
return 0;
}