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

  1. @node _dos_open, dos
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <fcntl.h>
  6. #include <share.h>
  7. #include <dos.h>
  8.  
  9. unsigned int _dos_open(const char *filename, unsigned short mode, int *handle);
  10. @end example
  11.  
  12. @subheading Description
  13.  
  14. This is a direct connection to the MS-DOS open function call (%ah = 0x3D).
  15. This function opens the given file with the given mode and puts handle of
  16. file into @var{handle} if openning is successful.
  17. Meaning of @var{mode} parameter is the following:
  18.  
  19. Access mode bits (in FCNTL.H):
  20. @table @code
  21.  
  22. @item O_RDONLY (_O_RDONLY) 0x00
  23.  
  24. Open for read only
  25.  
  26. @item O_WRONLY (_O_WRONLY) 0x01
  27.  
  28. Open for write only
  29.  
  30. @item O_RDWR (_O_RDWR) 0x02
  31.  
  32. Open for read and write
  33.  
  34. @end table
  35.  
  36. Sharing mode bits (in SHARE.H):
  37. @table @code
  38.  
  39. @item SH_COMPAT (_SH_COMPAT) 0x00
  40.  
  41. Compatibility mode
  42.  
  43. @item SH_DENYRW (_SH_DENYRW) 0x10
  44.  
  45. Deny read/write mode
  46.  
  47. @item SH_DENYWR (_SH_DENYWR) 0x20
  48.  
  49. Deny write mode
  50.  
  51. @item SH_DENYRD (_SH_DENYRD) 0x30
  52.  
  53. Deny read mode
  54.  
  55. @item SH_DENYNO (_SH_DENYNO) 0x40
  56.  
  57. Deny none mode
  58.  
  59. @end table
  60.  
  61. Inheritance bits (in FCNTL.H):
  62. @table @code
  63.  
  64. @item O_NOINHERIT (_O_NOINHERIT) 0x80
  65.  
  66. File is not inherited by child process
  67.  
  68. @end table
  69.  
  70. @xref{_dos_creat}. @xref{_dos_creatnew}. @xref{_dos_read}.
  71. @xref{_dos_write}. @xref{_dos_close}
  72.  
  73. @subheading Return Value
  74.  
  75. Returns 0 if successful or DOS error code on error (and sets
  76. @var{errno} to EACCES, EINVAL, EMFILE or ENOENT).
  77.  
  78. @subheading Example
  79.  
  80. @example
  81. int handle;
  82.  
  83. if ( !_dos_open("FOO.DAT", O_RDWR, &handle) )
  84.    puts("Wow, file opening was successful !");
  85. @end example
  86.