Function 3Ch (60)        Create a File (CREAT)

Create a new file or open and truncate an existing file to zero

On entry:      AH         3Ch
CX         File attribute
DS:DX      Pointer to filename (ASCIIZ string)

Returns:       AX         File handle, if CF is not set, or
Error code, if CF is set

Error codes:   3          Path not found
4          No handle available
5          Access denied (file is read-only, or root
directory is full)

Call Function 59h for extended error code information
(DOS 3.0 and above).

Network:       Requires Create access rights.


This function opens the file whose pathname is specified in the ASCIIZ
string at DS:DX. If the file doesn't already exist, it is created.
Warning: If a file with the specified name already exists, it is
truncated to zero length, effectively deleting the old data from the
file. The file is opened for read/write.

Notes:         The CX register specifies the attribute of the file
you're creating, as follows:

      CX       Attribute specified
00h      Normal
01h      Read-only
02h      Hidden
04h      System

Sum the values to combine attributes.

Information can be written to a file created in
Read-only mode. However, using this function to open
an existing read-only file will generate an error.

The CHMOD function (43h) can be used to change the
file's attribute.

See also: 16h
See also: 43h
See also: 5Ah
See also: 5Bh
See also: 59h
See also: File attribute

3Ch (60) Create a File (CREAT)