home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:20336 comp.os.msdos.programmer:12535
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!spool.mu.edu!olivea!charnel!psgrain!m2xenix!clark!pacifier!nathans
- From: nathans@pacifier.rain.com (Nathan Silva)
- Newsgroups: comp.lang.c,comp.os.msdos.programmer
- Subject: Re: DOS File Locking
- Summary: Summary of replies
- Message-ID: <C1JAGL.KIB@pacifier.rain.com>
- Date: 27 Jan 93 22:28:52 GMT
- Followup-To: comp.os.msdos.programmer
- Organization: Pacifier BBS
- Lines: 30
-
-
- >
- >I am writing a small Windows application in Turbo C++. I'd like
- >to lock a region of a file so that other processes can still read
- >it, but cannot write to it. However, when I use the standard
- >lock/unlock functions, other processes cannot read the locked region.
- >
-
- As some of you pointed out, comp.lang.c is not the best newsgroup for
- this. However, since some people asked for a summary, here it is
- (followups to comp.os.msdos.programmer).
-
- One person suggested adding a one-byte "flag" to the structure that I
- am using. The flag would be used to control access to that particular
- record. This is a good choice if portability is a concern.
-
- Another reply described an interesting technique - lock a nonexistent
- portion of the file. For example, to "lock" bytes 250-350, you would
- lock (logical) bytes 1,000,000,250 - 1,000,000,350. This works under
- DOS/Windows... I don't know if it's portable. This is the method I'm
- using.
-
- There were other replies; thanks to all who replied.
-
- Nathan
- --
- -------------------------------------------------------
- | Nathan Silva | |
- | nathans@pacifier.rain.com | Do the World News Polka! |
- -------------------------------------------------------
-