Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
_dos_creat, _dos_creatnew
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The _dos_creat and _dos_creatnew routines create and open a new
file named <filename>. This new file has the access attributes
specified in the <attrib> argument. The new file's handle is
copied into the integer location pointed to by <handle>. The file
is opened for both read and write access. If file sharing is
installed, the file is opened in compatibility mode.
The _dos_creat routine uses system call INT 0x3C, and the
_dos_creatnew routine uses system call INT 0x5B. If the file
already exists, _dos_creat erases its contents and leaves its
attributes unchanged. The _dos_creatnew routine, however, fails
if the file already exists.
Return Value
If successful, both routines return 0. Otherwise, they return the
DOS error code and set errno to EACCES, EEXIST, EMFILE, or ENOENT.
-♦-