File Sharing Modes Available with the sopen() Function

Last reviewed: July 17, 1997
Article ID: Q66129
6.00 6.00a 6.00ax 7.00 | 1.00 1.50
MS-DOS                 | WINDOWS
kbprg

The information in this article applies to:

  • The C Run-time (CRT), included with:

        - Microsoft C for MS-DOS, versions 6.0, 6.0a, and 6.0ax
        - Microsoft C/C++ for MS-DOS, version 7.0
        - Microsoft Visual C++ for Windows, versions 1.0 and 1.5
    

SUMMARY

An application can open files for sharing using the sopen() run-time library function. The application specifies the desired sharing by passing an integer argument to sopen().

MORE INFORMATION

The shflag parameter to the sopen() function can contain one of the five manifest constants. The table below lists the constants and their uses.

SH_COMPAT   Compatibility mode. Other programs can open the file and
            perform read or write operations if every program
            specifies compatibility mode. This sharing mode is used by
            the open() function when an application runs in the MS-DOS
            operating system. This sharing mode is not available in
            the OS/2 operating system.

SH_DENYNO   Deny none. Other programs can open the file and perform
            read or write operations. However, another program cannot
            open the file in compatibility mode. This the sharing mode
            used by the open() function when an application runs in
            the OS/2 operating system.

SH_DENYRW   Deny all. Other programs cannot open the file.

SH_DENYWR   Deny write. Other programs cannot open the file in
            compatibility mode or to obtain write access.

SH_DENYRD   Deny read. Other programs cannot open the file in
            compatibility mode or to obtain read access.

In a network environment with the MS-DOS operating system, the SH_COMPAT mode is recommended if the file is shared for reading and for writing. For more information about file modes, see Article 7, "File and Record Management," in the "MS-DOS Encyclopedia" (Microsoft Press).


Additional reference words: kbinf 6.00 6.00a 6.00ax 7.00 1.00 1.50
KBCategory: kbprg
KBSubcategory: CRTIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.