2007-10-15 11:42:17 +02:00
|
|
|
#include <stdio.h>
|
2006-09-07 16:14:53 +02:00
|
|
|
int fseek(FILE* file,long offset,int origin)
|
|
|
|
{
|
2016-04-30 15:50:04 +02:00
|
|
|
fpos_t pos;
|
2016-05-19 14:15:22 +02:00
|
|
|
if(!file)
|
|
|
|
{
|
|
|
|
errno = E_INVALIDPTR;
|
|
|
|
return errno;
|
|
|
|
}
|
|
|
|
|
2006-09-07 16:14:53 +02:00
|
|
|
if (origin==SEEK_CUR)
|
|
|
|
offset+=file->filepos;
|
|
|
|
else if (origin==SEEK_END)
|
|
|
|
offset+=file->filesize;
|
|
|
|
else if (origin!=SEEK_SET)
|
|
|
|
return EOF;
|
2016-04-30 15:50:04 +02:00
|
|
|
pos = offset;
|
2016-05-19 14:15:22 +02:00
|
|
|
return fsetpos(file, &pos);
|
|
|
|
}
|