HCreate
HCreate Create a new file like PBHCreate and set type and creator short vRefNum; volume or directory reference number long dirID; directory ID
Str255 fileName; address of length-prefixed full or partial name OSType creator; 32-bit creator ID (your app's signature) OSType fileType; 32-bit file type (e.g., 'TEXT' or custom type) HCreate creates a new file like PBHCreate, and then sets the file type and creator of the file.
vRefNum is the reference number of the volume or working directory to contain fileName . See FSOpen for a description of the options. dirID is the directory ID of the directory to contain fileName.
fileName is the address of a length-prefixed, pascal-style string containing
the name of the file to be created. It may be a partial or full
pathname, depending upon the value of vRefNum . You should NOT use names beginning with a period ('.') since that convention is reserved
for devices.
creator is a 32-bit value, often expressed as a four-letter literal (e.g.,
'MSWD'). It is normally the unique signature of your application
(as registered with Apple), or the signature of the application which
want to be launched when this file is double-clicked in the Finder.
Note: use creator = '????' if you don't want the file to auto-start any application.
fileType is a 32-bit value, normally expressed as a four-letter literal (e.g.,
'TEXT'). It identifies the file type, which helps applications
determine how to process the file. This value is used in file filtering
noErr (0) No error
bdNamErr (-37) Bad name
dirFulErr (-33) Directory full
dupFNErr (-48) Duplicate filename (rename)
extFSErr (-58) External file system
ioErr (-36) I/O error
nsvErr (-35) No such volume
vLckdErr (-46) Volume is locked
wPrErr (-44) Diskette is write-protected
Notes: Use SetFInfo for control over other de scriptive information about the file, such as the Finder's placement of the file's icon in its folder, whether
or not the file has a bundle of de scriptive resources, and whether the file's
icon is in visible.
Use FSOpen to initiate file access - this function does not open the file. pre-allocate as much storage as the file will need.