www.delorie.com/djgpp/doc/libc/libc_146.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]



#include <fcntl.h>

int __djgpp_share_flags = ...;


This variable controls the share flags used by open (and hence fopen) when opening a file.

If you assign any value other than 0 to this variable libc will use that value for the sharing bits when if calls DOS to open the file. But if you specify any share flag in the open call then these flags will remain untouched. In this way __djgpp_share_flags acts just like a default and by default is 0 ensuring maximum compatibility with older versions of djgpp.

If you don't know how the share flags act consult any DOS reference. They allow to share or protect a file when it's opened more than once by the same task or by two or more tasks. The exact behavior depends on the exact case. One interesting thing is that when the file is opened by two tasks under Windows the results are different if you use Windows 3.1 or Windows 95. To add even more complexity Windows 3.1 is affected by SHARE.EXE.

The available flags are:

SH_COMPAT 0x0000

That's the compatible mode.

SH_DENYRW 0x0010

Deny read and deny write.

SH_DENYWR 0x0020

Deny write.

SH_DENYRD 0x0030

Deny read.

SH_DENYNO 0x0040

No deny.

Of course these flags are DOS specific and doesn't exist under other OSs; and as you can imagine __djgpp_share_flags is djgpp specific.

See section open. See section fopen.



  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004