Important: The information in this document is obsolete and should not be used for new development.
HCreate
You can use theHCreatefunction to create a new file.
FUNCTION HCreate (vRefNum: Integer; dirID: LongInt; fileName: Str255; creator: OSType; fileType: OSType): OSErr;
vRefNum- A volume reference number, a working directory reference number, or 0 for the default volume.
dirID- A directory ID.
fileName- The name of the new file.
creator- The creator of the new file.
fileType- The file type of the new file.
DESCRIPTION
TheHCreatefunction creates a new file (both forks) with the specified name, creator, and file type. For information on a file's creator and type, see the chapter "Finder Interface" in Inside Macintosh: Macintosh Toolbox Essentials.The new file is unlocked and empty. The date and time of its creation and last modification are set to the current date and time.
Files created using
HCreateare not automatically opened. If you want to write data to the new file, you must first open the file using a file access routine.
You should not allow users to give files names that begin with a period (.). This ensures that files can be successfully opened by applications calling
- Note
- The resource fork of the new file exists but is empty. You'll need to
call one of the Resource Manager proceduresCreateResFile,HCreateResFile, orFSpCreateResFileto create a resource map in the file before you can open it (by calling one of the Resource Manager functionsOpenResFile,HOpenResFile, orFSpOpenResFile).![]()
HOpeninstead ofHOpenDF.RESULT CODES