home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / compat / d_creat.txh < prev    next >
Encoding:
Text File  |  1995-10-09  |  1.1 KB  |  57 lines

  1. @node _dos_creat, dos
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <dos.h>
  6.  
  7. unsigned int _dos_creat(const char *filename, unsigned short attr, int *handle);
  8. @end example
  9.  
  10. @subheading Description
  11.  
  12. This is a direct connection to the MS-DOS creat function call (%ah = 0x3C).
  13. This function creates the given file with the given attribute and puts
  14. file handle into @var{handle} if creating is successful. If the file
  15. already exists it truncates the file to zero length. Meaning of @var{attr}
  16. parameter is the following:
  17.  
  18. @table @code
  19.  
  20. @item _A_NORMAL (0x00)
  21.  
  22. Normal file (no read/write restrictions)
  23.  
  24. @item _A_RDONLY (0x01)
  25.  
  26. Read only file
  27.  
  28. @item _A_HIDDEN (0x02)
  29.  
  30. Hidden file
  31.  
  32. @item _A_SYSTEM (0x04)
  33.  
  34. System file
  35.  
  36. @item _A_ARCH (0x20)
  37.  
  38. Archive file
  39.  
  40. @end table
  41.  
  42. @xref{_dos_open}. @xref{_dos_creatnew}. @xref{_dos_read}.
  43. @xref{_dos_write}. @xref{_dos_close}
  44.  
  45. @subheading Return Value
  46.  
  47. Returns 0 if successful or DOS error code on error (and sets @var{errno})
  48.  
  49. @subheading Example
  50.  
  51. @example
  52. int handle;
  53.  
  54. if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  55.    puts("Creating was successful !");
  56. @end example
  57.