Important: The information in this document is obsolete and should not be used for new development.
CloseResFile
You can use theCloseResFileprocedure to close a resource fork before your application terminates.
PROCEDURE CloseResFile (refNum: Integer);
refNum- The file reference number for the resource fork to close.
DESCRIPTION
Given a file reference number for a file whose resource fork is open, theCloseResFileprocedure performs four tasks. First, it updates the file by calling theUpdateResFileprocedure. Second, it releases the memory occupied by each resource in the resource fork by calling theDisposeHandleprocedure. Third, it releases the memory occupied by the resource map. The fourth task is to close the resource fork.If the
refNumparameter does not contain a file reference number for a file whose resource fork is open,CloseResFiledoes nothing, and theResErrorfunction returns the result coderesFNotFound. If the value of therefNumparameter is 0, it represents the System file and is ignored. You cannot close the System file's resource fork.When your application terminates, the Resource Manager automatically closes every resource fork open to your application except the System file's resource fork. You need to call the
CloseResFileprocedure only if you want to close a resource fork before your application terminates.RESULT CODES
noErr 0 No error resFNotFound -193 Resource file not found SEE ALSO
To check for errors, call theResErrorfunction as described on page 1-47.For an example of the use of the
CloseResFileprocedure, see Listing 1-9 on page 1-26.For descriptions of the
UpdateResFileandReleaseResourceprocedures, see page 1-87 and page 1-101, respectively.