Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / File Manager Reference
Low-Level File Access Routines / Manipulating the End-of-File


PBSetEOF

You can use the PBSetEOF function to set the logical end-of-file of an open file.

FUNCTION PBSetEOF (paramBlock: ParmBlkPtr; async: Boolean): OSErr;
paramBlock
A pointer to a basic File Manager parameter block.
async
A Boolean value that specifies asynchronous (TRUE) or synchronous (FALSE) execution.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe result code of the function.
-->ioRefNumIntegerA file reference number.
-->ioMiscPtrThe logical end-of-file.

DESCRIPTION
The PBSetEOF function sets the logical end-of-file of the open file, whose access path is specified by ioRefNum, to ioMisc. Because the ioMisc field is of type Ptr, you must coerce the desired value from type LongInt to type Ptr.

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 PBSetEOF returns dskFulErr as its function result.

If the value of the ioMisc field 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 INFORMATION
The trap macro for PBSetEOF is _SetEOF.

RESULT CODES
noErr0No error
dskFulErr-34Disk full
ioErr-36I/O error
fnOpnErr-38File not open
wPrErr-44Hardware volume lock
fLckdErr-45File is locked
vLckdErr-46Software volume lock
rfNumErr-51Bad reference number
wrPermErr-61Read/write permission doesn't allow writing

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996