dosopen
Purpose
Opens a DOS file.
Library
DOS Services Library (libdos.a)
Syntax
#include <dos.h>
DOSFILE dosopen (path, oflag, mode)
char *path;
int oflag;
long mode;
Description
The dosopen subroutine opens the file specified by the
path parameter. The oflag parameter specifies the type
of open. The mode parameter specifies the access mode of
the file if a new file is created.
The oflag parameter is constructed by logically OR-ing
one or more of the following values:
DO_RDONLY Open for reading only.
DO_WRONLY Open for writing only.
DO_RDWR Open for reading and writing.
DO_APPEND If set, the file pointer is set to the end
of the file prior to each write operation.
DO_CREAT If the file does not exist, create it. Use
mode to establish the protection mode of the
new file. (For information on creating a
DOS file, see "doscreate.")
DO_TRUNC If the file exists, truncate it. Otherwise
begin writing at the end of file.
DO_EXCL If the file already exists, the dosopen sub-
routine fails.
DO_ASCII Interpret the file as an ASCII text file.
(For information about ASCII files, see
"dosread" and "doswrite.")
Note: Only one of DO_RDONLY, DO_WRONLY, and DO_RDWR can
be specified. The others can be used in any combination.
If the file being opened is on a DOS file system, the
name file name given is translated to uppercase. If the
file system is an AIX file system, no translation takes
place.
Warning: DOS files are not implicitly closed when a
process terminates. You must explicitly close all DOS
files or you may lose data.
Return Value
Upon successful completion, a DOS Services file handle is
returned. This handle is used in subsequent operations.
If the dosopen subroutine fails, -1 value is returned and
doserrno is set to indicate the error.
Related Information
In this book: "DOS services library," "dosclose,"
"doscreate," "dosdup," "dosread," "dosseek," and
"doswrite."