Prev: PeekNamedPipe and ReadFile
Next: cl options
From: Rover on 2 Nov 2009 19:30 Hi all, I know there is a function called _fsopen() that allows one to specify the file sharing mode. Does anyone know what is the assumed file sharing mode when one calls fopen()? What is the equivalent to CreateFile's share mode value? My experiments allow me to open two files at the same time in two different process irrespective of reading or writing. But I have not tried to write or read from them. Thanks. Rover
From: Alex Blekhman on 3 Nov 2009 04:40 "Rover" wrote: > I know there is a function called _fsopen() that allows one to > specify the file sharing mode. > > Does anyone know what is the assumed file sharing mode when one > calls fopen()? What is the equivalent to CreateFile's share mode > value? You could just debug the `fopen' call. VS ships with the source code for CRT library. `fopen' is a mere wrapper over _fsopen(..., _SH_DENYNO) call. Alex
From: Leon on 15 Nov 2009 00:43 Hi Alex, Thanks for the advice. So without proper concurrency control and file locking, multiple users of a file can use fopen() to open the file but their access will corrupt the file or retrieving corrupted data much like failure to control access to a share resource in MT programming. Is that what will happen? Leon "Alex Blekhman" <tkfx.NOSPAM(a)yahoo.com> wrote in message news:uTMrBnGXKHA.4068(a)TK2MSFTNGP06.phx.gbl... > "Rover" wrote: >> I know there is a function called _fsopen() that allows one to specify >> the file sharing mode. >> >> Does anyone know what is the assumed file sharing mode when one calls >> fopen()? What is the equivalent to CreateFile's share mode value? > > You could just debug the `fopen' call. VS ships with the source code for > CRT library. `fopen' is a mere wrapper over _fsopen(..., _SH_DENYNO) call. > > Alex
From: Alex Blekhman on 15 Nov 2009 07:02 "Leon" wrote: > So without proper concurrency control and file locking, multiple > users of a file can use fopen() to open the file but their > access will corrupt the file or retrieving corrupted data much > like failure to control access to a share resource in MT > programming. Is that what will happen? Exactly. SH_DENYNO flag permits read and write access to a file. Without proper synchronization you'll corrupt a file. Alex
|
Pages: 1 Prev: PeekNamedPipe and ReadFile Next: cl options |