2022-01-02 22:09:06 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
int fsetpos(FILE *fp, fpos_t const *pos)
|
|
|
|
{
|
|
|
|
if(fflush(fp) == EOF)
|
|
|
|
return -1;
|
|
|
|
|
2022-01-10 21:32:24 +01:00
|
|
|
off_t rc = lseek(fp->fd, *pos, SEEK_SET);
|
|
|
|
if(rc < 0)
|
|
|
|
return -1;
|
|
|
|
|
2022-01-02 22:09:06 +01:00
|
|
|
fp->fdpos = *pos;
|
|
|
|
fp->eof = 0;
|
|
|
|
return 0;
|
|
|
|
}
|