Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <dos.h>
    unsigned _dos_creatnew( char *path,
                            unsigned attribute,
                            int *handle );

Description:
    The _dos_creatnew function uses system call 0x5B to create a new file
    named path, with the access attributes specified by attribute.  The
    handle for the new file is returned in the word pointed to by handle.
     If the file already exists, the create will fail.  The possible values
    for attribute are:

    Attribute     Meaning

_A_NORMAL
    Indicates a normal file.  File can be read or written without any
    restrictions.

_A_RDONLY
    Indicates a read-only file.  File cannot be opened for "write".

_A_HIDDEN
    Indicates a hidden file.  This file will not show up in a normal
    directory search.

_A_SYSTEM
    Indicates a system file.  This file will not show up in a normal
    directory search.


Returns:
    The _dos_creatnew function returns zero if successful.  Otherwise, it
    returns an MS-DOS error code and sets  errno to one of the following
    values:

    Constant     Meaning

EACCES
    Access denied because the directory is full, or the file exists and
    cannot be overwritten.

EEXIST
    File already exists

EMFILE
    No more handles available, (too many open files)

ENOENT
    Path or file not found


Example:
    #include <stdio.h>
    #include <dos.h>

    void main()
      {
        int handle1, handle2;
        if( _dos_creat( "file", _A_NORMAL, &handle1 ) ){
          printf( "Unable to create file\n" );
        } else {
          printf( "Create succeeded\n" );
          if( _dos_creatnew( "file", _A_NORMAL, &handle2 ) ){
            printf( "Unable to create new file\n" );
          }
          _dos_close( handle1 );
        }
      }

Classification:
    DOS

Systems:
    DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32, DOS/PM

See Also:
    creat, _dos_creat, _dos_open, open

See Also: _dos_creat _dos_open

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson