HCreate
HCreate Create a new file like PBHCreate and set type and creator
#include <Files.h> File Manager
OSErr HCreate( vRefNum, dirID, fileName, creator, fileType );
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)
returns Error Code; 0=no error
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
(see SFGetFile, et.al).
Returns: an operating system Error Code. It will be one of:
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.
You may wish to use Allocate or SetEOF or PBAllocContig to
pre-allocate as much storage as the file will need.
See OpenRF for an example of usage.