PBSetEOFYou can use the
PBSetEOFfunction to set the logical end-of-file of an open file.
FUNCTION PBSetEOF (paramBlock: ParmBlkPtr; async: Boolean): OSErr;
- A pointer to a basic File Manager parameter block.
- A Boolean value that specifies asynchronous (
TRUE) or synchronous (
A pointer to a completion routine. <--
The result code of the function. -->
A file reference number. -->
The logical end-of-file.
PBSetEOFfunction sets the logical end-of-file of the open file, whose access path is specified by
ioMisc. Because the
ioMiscfield is of type
Ptr, you must coerce the desired value from type
If you attempt to set the logical end-of-file beyond the current physical end-of-file, another allocation block is added to the file; if there isn't enough space on the volume,
no change is made and
dskFulErras its function result.
If the value of the
ioMiscfield is 0, all space occupied by the file on the volume is released. The file still exists, but it contains 0 bytes. Setting a file fork's end-of-file to 0
is therefore not the same as deleting the file (which removes both file forks at once).
ASSEMBLY-LANGUAGE INFORMATIONThe trap macro for
noErr 0 No error dskFulErr -34 Disk full ioErr -36 I/O error fnOpnErr -38 File not open wPrErr -44 Hardware volume lock fLckdErr -45 File is locked vLckdErr -46 Software volume lock rfNumErr -51 Bad reference number wrPermErr -61 Read/write permission doesn't allow writing