Important: The information in this document is obsolete and should not be used for new development.
CloseResFile
You can use theCloseResFile
procedure 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, theCloseResFile
procedure performs four tasks. First, it updates the file by calling theUpdateResFile
procedure. Second, it releases the memory occupied by each resource in the resource fork by calling theDisposeHandle
procedure. Third, it releases the memory occupied by the resource map. The fourth task is to close the resource fork.If the
refNum
parameter does not contain a file reference number for a file whose resource fork is open,CloseResFile
does nothing, and theResError
function returns the result coderesFNotFound
. If the value of therefNum
parameter 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
CloseResFile
procedure 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 theResError
function as described on page 1-47.For an example of the use of the
CloseResFile
procedure, see Listing 1-9 on page 1-26.For descriptions of the
UpdateResFile
andReleaseResource
procedures, see page 1-87 and page 1-101, respectively.