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/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <dos.h>
    unsigned _dos_creat( char *path,
                         unsigned attribute,
                         int *handle );

Description:
    The _dos_creat function uses system call 0x3C 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 contents will be erased, and the attributes of the
    file will remain unchanged.  The possible values for attribute are:

    _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_creat function returns zero if successful.  Otherwise, it
    returns an MS-DOS error code and sets  errno to one of the following
    values:

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

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

    ENOENT
        Path or file not found


See Also:
    creat, _dos_creatnew, _dos_open, open

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

    void main()
      {
        int handle;

        if( _dos_creat( "file", _A_NORMAL, &handle ) != 0 ){
          printf( "Unable to create file\n" );
        } else {
          printf( "Create succeeded\n" );
          _dos_close( handle );
        }
      }

Classification:
    DOS

Systems:
    DOS, Win, OS/2 1.x(all), OS/2 2.x, NT, DOS/PM

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