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: More Macintosh Toolbox /
Chapter 1 - Resource Manager / Resource Manager Reference
Resource Manager Routines / Creating an Empty Resource Fork


HCreateResFile

If the FSpCreateResFile procedure is not available, you can use the HCreateResFile procedure to create an empty resource fork.

PROCEDURE HCreateResFile (vRefNum: Integer; dirID: LongInt;
                          fileName: Str255);
vRefNum
The volume reference number of the volume on which the file is located.
dirID
The directory ID of the directory where the file is located.
fileName
The name of the file whose resource fork is to be created.
DESCRIPTION
The HCreateResFile procedure creates a file with an empty resource fork in the directory specified by the vRefNum and dirID parameters. (An empty resource fork contains no resource data but does include a resource map.)

If no other file with the given name exists in the specified directory, HCreateResFile creates a resource file--that is, a resource fork, including a resource map. In this case the file has a zero-length data fork.

If a file with the specified name already exists and includes a resource fork with a resource map, HCreateResFile does nothing. If the data fork of the specified file already exists but the file has a zero-length resource fork, HCreateResFile creates an empty resource fork and resource map for the file.

Before you can work with the newly created file's resource fork, you must first use HOpenResFile or a related function to open it.

SPECIAL CONSIDERATIONS
The HCreateResFile procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.

RESULT CODES
noErr0No error
dirFulErr-33Directory full
dskFulErr-34Disk full
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename or volume name (perhaps zero length)
tmfoErr-42Too many files open
wPrErr-44Disk is write-protected
fLckdErr-45File is locked
SEE ALSO
To check for errors, call the ResError function as described on page 1-47.

For a description of the HOpenResFile function, see page 1-58.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996