Poor Man's Search Path
ConstStr255Param fileName ; address of length-prefixed filename
This function creates a new file with empty resource and data forks. If the
file already exists and has a non-empty resource fork, CreateResFile fails. which is described below.
fileName is the address of a Pascal-style length-prefixed file name. It may
contain volume and directory names. If volume and directory names
are omitted, the working directory is assumed.
expected.
Notes: This function does not open the file. After creating the resource file, use
OpenResFile to obtain its file reference number and prepare for subsequent access.
If filename already exists and has a non-empty resource fork, this does
NOT empty it. Instead, CreateResFile fails silently. Be sure to call Creating new resource files is not that common; development tools such as
ResEdit and RMaker exist for the purpose. If you do need to create one
yourself, a typical sequence is:
• Create Create a resource file if it does not exist CreateResFile checks to see if a resource file with a given name exists;if it does, it returns a dupFNErr (-48) error. Unfortunately,
(PMSP). That is, it searches the current directory first, then searches the
blessed folder (the folder containing the currently booted system and
Finder) on the same volume. This means that CreateResFile will fail if a file with the same name already exists in a directory that is in the PMSP.
To make sure that CreateResFile will create a resource file in the current directory (whether or not a resource file with the same name
already exists further down the PMSP), call either PBCreate or Create do not use the PMSP. By guaranteeing that the resource file exists in the
current directory, you can avoid having CreateResFile fail by finding another resource file with the same name somewhere else in the PMSP.