Add FSWrite, GetFPos, SetFPos

This commit is contained in:
Charles Lehner 2014-09-26 01:05:40 -04:00
parent fda2e0a378
commit c6b5221803

View File

@ -110,6 +110,20 @@ pascal OSErr FSRead (short refNum, long *count, void *buffPtr)
return err; return err;
} }
pascal OSErr FSWrite (short refNum, long *count, const void *buffPtr)
{
OSErr err;
ParamBlockRec pb;
memset(&pb, 0, sizeof(pb));
pb.ioParam.ioRefNum = refNum;
pb.ioParam.ioBuffer = (void *)buffPtr;
pb.ioParam.ioReqCount = *count;
err = PBWriteSync(&pb);
*count = pb.ioParam.ioActCount;
return err;
}
pascal OSErr GetEOF (short refNum, long *logEOF) pascal OSErr GetEOF (short refNum, long *logEOF)
{ {
OSErr err; OSErr err;
@ -120,3 +134,23 @@ pascal OSErr GetEOF (short refNum, long *logEOF)
*logEOF = (long)pb.ioParam.ioMisc; *logEOF = (long)pb.ioParam.ioMisc;
return err; return err;
} }
pascal OSErr GetFPos (short refNum, long *filePos)
{
OSErr err;
ParamBlockRec pb;
pb.ioParam.ioRefNum = refNum;
err = PBGetFPosSync(&pb);
*filePos = pb.ioParam.ioPosOffset;
return err;
}
pascal OSErr SetFPos (short refNum, short posMode, long posOff)
{
ParamBlockRec pb;
memset(&pb, 0, sizeof(pb));
pb.ioParam.ioRefNum = refNum;
pb.ioParam.ioPosMode = posMode;
pb.ioParam.ioPosOffset = posOff;
return PBSetFPosSync(&pb);
}