Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>creattemp() create a new file or rewrite an existing one</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
creattemp()              Create a New File or Rewrite an Existing One

 #include   <dos.h>

 int        creattemp(filename,attrib);
 char       *filename;                   Name of new file
 int        attrib;                      Attribute word

    creattemp() creates a new file or rewrites an existing file associated
    with the name 'filename'.  'filename' is a path name ending with a
    backslash (\).  A unique file name is created in the directory given
    by 'filename'.  The new file name is stored in 'filename'.  'filename'
    should be long enough to hold the resulting file name.  The file is
    not automatically deleted when the program terminates.

    _creattemp() 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

See Also: creat() _creat() creatnew()

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