INF: Using shflag Parameter with sopen()

ID Number: Q66129

6.00 6.00a 6.00ax 7.00

MS-DOS

Summary:

In Microsoft C versions 6.0, 6.0a, 6.0ax, and C/C++ version 7.0, the

sopen() run-time library routine is used to open files for sharing. The

type of sharing can be specified by passing an integer value as an

argument to sopen().

More information:

The shflag parameter used with the sopen() function can be one of five

manifest constants (defined in FCNTL.H). The following lists the

constants and their uses:

SH_COMPAT Sets compatibility mode. Other programs can open the file

and perform read or write operations as long as no process

specifies any sharing mode other than compatibility mode.

This is the sharing mode used in the open function under

MS-DOS. This sharing code is not available under OS/2.

SH_DENYRW Deny all. Other programs cannot open the file.

SH_DENYWR Deny write. Other programs cannot open the file in

compatibility mode or with write access.

SH_DENYRD Deny read. Other program cannot open the file in

compatibility mode or with read access.

SH_DENYNO Deny none. Other programs can open the file and perform

both read and write operations but cannot open the file in

compatibility mode. This is the sharing mode used in the

open function under OS/2.

In a network environment under MS-DOS, it is recommended that the

SH_COMPAT mode be used if the file is to be shared for reading and

writing. For more information about file modes, see the "MS-DOS

Encyclopedia," article 7, "File and Record Management".

Additional reference words: 6.00 6.00a 6.00ax 7.00 \* \* MSINTERNAL: