mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-26 22:51:01 +00:00
Add FSWrite, GetFPos, SetFPos
This commit is contained in:
parent
fda2e0a378
commit
c6b5221803
@ -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);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user