@node _dos_open, dos @subheading Syntax @example #include #include #include unsigned int _dos_open(const char *filename, unsigned short mode, int *handle); @end example @subheading Description This is a direct connection to the MS-DOS open function call (%ah = 0x3D). This function opens the given file with the given mode and puts handle of file into @var{handle} if openning is successful. Meaning of @var{mode} parameter is the following: Access mode bits (in FCNTL.H): @table @code @item O_RDONLY (_O_RDONLY) 0x00 Open for read only @item O_WRONLY (_O_WRONLY) 0x01 Open for write only @item O_RDWR (_O_RDWR) 0x02 Open for read and write @end table Sharing mode bits (in SHARE.H): @table @code @item SH_COMPAT (_SH_COMPAT) 0x00 Compatibility mode @item SH_DENYRW (_SH_DENYRW) 0x10 Deny read/write mode @item SH_DENYWR (_SH_DENYWR) 0x20 Deny write mode @item SH_DENYRD (_SH_DENYRD) 0x30 Deny read mode @item SH_DENYNO (_SH_DENYNO) 0x40 Deny none mode @end table Inheritance bits (in FCNTL.H): @table @code @item O_NOINHERIT (_O_NOINHERIT) 0x80 File is not inherited by child process @end table See also @ref{_dos_creat}, @ref{_dos_creatnew}, @ref{_dos_read}, @ref{_dos_write}, and @ref{_dos_close}. This function does not support long filenames, even on systems where the LFN API (@pxref{_use_lfn, LFN}) is available. For LFN-aware functions with similar functionality see @ref{_open}, @ref{_creat}, and @ref{_creatnew}. Also see @ref{open}, and @ref{creat}, which are Posix-standard. @subheading Return Value Returns 0 if successful or DOS error code on error (and sets @var{errno} to EACCES, EINVAL, EMFILE or ENOENT). @subheading Portability @portability !ansi, !posix @subheading Example @example int handle; if ( !_dos_open("FOO.DAT", O_RDWR, &handle) ) puts("Wow, file opening was successful !"); @end example