I am trying to replicate WIN32 code for MacOSX, however I am unable to replicate a part of code
Here is the code.
main_int64 pos;
OP_ASSERT(sizeof(pos)==sizeof(fpos_t));
/*Translate the seek to an absolute one.*/
if(_whence==SEEK_CUR)
{
int ret;
ret=fgetpos((FILE *)_stream,(fpos_t *)&pos);
if(ret)return ret;
}
else if(_whence==SEEK_END)pos=_filelengthi64(_fileno((FILE *)_stream));
else if(_whence==SEEK_SET)pos=0;
else return -1;
/*Check for errors or overflow.*/
if(pos<0||_offset<-pos||_offset>OP_INT64_MAX-pos)return -1;
pos+=_offset;
int seeko = fsetpos((FILE *)_stream,(fpos_t *)&pos);
fprintf("BaseTool", "SEEKO VALUE %d \n", seeko);
return seeko;
I am stuck at
else
if(_whence==SEEK_END)pos=_filelengthi64(_fileno((FILE *)_stream));
I am not sure how can I replace these functions in mac based system as these are WIN based functions