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
Utility Routines / Obtaining File Control Block Information


PBGetFCBInfo

You can use PBGetFCBInfo to get information about an open file.

FUNCTION PBGetFCBInfo (paramBlock: FCBPBPtr; async: Boolean): 
                        OSErr;
paramBlock
A pointer to a file control block 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.
<->ioNamePtrStringPtrA pointer to a pathname.
-->ioVRefNumIntegerA volume specification.
<->ioRefNumIntegerThe file reference number.
-->ioFCBIndxIntegerAn index.
<--ioFCBFlNmLongIntThe file ID.
<--ioFCBFlagsIntegerFile status flags.
<--ioFCBStBlkIntegerThe first allocation block of the file.
<--ioFCBEOFLongIntThe logical end-of-file.
<--ioFCBPLenLongIntThe physical end-of-file.
<--ioFCBCrPsLongIntThe position of the file mark.
<--ioFCBVRefNumIntegerThe volume reference number.
<--ioFCBClpSizLongIntThe file clump size.
<--ioFCBParIDLongIntThe parent directory ID.

DESCRIPTION
The PBGetFCBInfo function returns information about the specified open file. If the value of ioFCBIndx is positive, the File Manager returns information about the file whose index in the FCB buffer is ioFCBIndx and that is located on the volume specified by ioVRefNum (which may contain a drive number, volume reference number, or working directory reference number). If the value of ioVRefNum is 0, all open files are indexed; otherwise, only open files on the specified volume are indexed.

If the value of ioFCBIndx is 0, the File Manager returns information about the file whose file reference number is specified by the ioRefNum field. If the value of ioFCBIndx is positive, the ioRefNum field is ignored on input and contains the file reference number on output.

If PBGetFCBInfo executes successfully, the ioNamePtr field contains the name of the specified open file. You should pass a pointer to a Str31 value if you want that name returned. If you pass NIL in the ioNamePtr field, no filename is returned.

The ioFCBFlags field returns status information about the specified open file. See
"File Control Block Parameter Blocks" beginning on page 2-107 for a description of
the meaning of the bits in this field.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for PBGetFCBInfo are
Trap macroSelector
_HFSDispatch$0008

RESULT CODES
noErr0No error
nsvErr-35Specified volume doesn't exist
fnOpnErr-38File not open
rfNumErr-51Reference number specifies nonexistent access path

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996