creatnew()               Create a New File
 
 #include   <dos.h>
 
 int        creatnew(filename,attrib);
 char       *filename;                   Name of new file
 int        attrib;                      Attribute word
 
    creatnew() creates a new file associated with the name 'filename'.
    creatnew() is identical to _creat() except that, if the file exists,
    creatnew() returns an error and leaves the file untouched.
 
    _creatnew() accepts 'attrib' (an MS-DOS attribute word).  Any
    attribute bits may be set in this call.  The file is always opened in
    binary mode.  If successfully opened, the file pointer is set to the
    beginning of the file.  The file is opened for both reading and
    writing. 'attrib' must be one of the following constants (defined in
    <dos.h>):
                FA_RDONLY     Read only attribute
                FA_HIDDEN     Hidden file
                FA_SYSTEM     System file
 
    Returns:    If successfully created, the new file handle is returned.
                The file handle must be non-negative.  On error, -1 is
                returned and 'errno' (defined in <stdlib.h>) is set to one
                of the following:
 
                ENOENT        Path or file name not found
                EMFILE        Too many open files
                EACCES        Permission denied
 

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster