Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - dos_creat http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                                dos_creat

   Usage
   include <dos.h>
   int dos_creat(char *name,unsigned attribute);

   Description
   Create  a  file  in  a  DOS environment as  opposed  to  a  UNIX  type
   environment (there is no `write-only' option as is found in UNIX). The
   attribute byte is the same as described in the DOS Technical Reference
   Manual. Here are the attributes defined in dos.h:

   FA_RDONLY 0x01 Read Only
   FA_HIDDEN 0x02 Hidden file
   FA_SYSTEM 0x04 System file
   FA_LABEL  0x08 Volume label
   FA_DIREC  0x10 Sub-directory
   FA_ARCH   0x20 Archive bit

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

   main()
   {
   int handle;

        if((handle = dos_creat("temp.fil",FA_ARCH)) == -1)
             perror("Unable to create file");
        else
             printf("File created successfully\n");
   }

   Return Value
   Returns a DOS handle if the file was successfully created otherwise  a
   -1 and errno is set.


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