home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!spool.mu.edu!uwm.edu!rpi!batcomputer!cornell!uw-beaver!news.tek.com!psgrain!qiclab!leonard
- From: leonard@qiclab.scn.rain.com (Leonard Erickson)
- Subject: Re: File locking question
- Message-ID: <1993Jan12.064806.9011@qiclab.scn.rain.com>
- Reply-To: Leonard.Erickson@f51.n105.z1.fidonet.org
- Organization: SCN Research/Qic Laboratories of Tigard, Oregon.
- References: <Hendrik.Klompmaker.31.726184187@beheer.zod.wau.nl> <ppollet.118.726255594@cismibm.univ-lyon1.fr> <1993Jan5.220346.24647@csx.cciw.ca>
- Date: Tue, 12 Jan 1993 06:48:06 GMT
- Lines: 44
-
- u055@csx.cciw.ca (James Sprenger) writes:
-
- >> If you want your files to be "SHAREABLE" you should fiddle with the
- >>FileMode public variable of TurboPascal BEFORE doing any Reset,Rewrite,
- >>Close (and possibly Append :I did not tried that one yet )
-
- >I don't think this will work 'cause the file that is accessed is
- >redirected from the command line, and not initialized from the TP prog.
- >Even if you did open the file from the TP program, I think you'll run into
- >problems when two people try to write to the file simultaneously (spelling?)
- >Any how, if you are using a Novell NetWare network, its probably best to
- >use semaphores...these netware function are faaaast and you don't have to
- >write your own lowlevel IO routines.
-
- Nope! Novell *has* to support the share operations. And it does. I wrote
- a program that did it this way. *much* simpler than semaphores for a short
- program.
-
-
- >> So my guess is that your program username should:
- >>
- >> -be compiled with $I- (no stop on runtime error)
- >>
- >> -Repeat
- >> -try to open the file in mode $11 (Write and deny ALL)
- >> -Until (IoResult=0) (* nobody else has locked it *)
- >>
-
- >I tried a similar routine with an app I was writing and never quite got it to
- >work. Maybe I should look at it again....
-
- It *will* work. As long as you onl;y want one process at a time using the file.
- I've gotten it to work with DenyAll-Read/Write, and with DenyNone-ReadOnly.
- The first for a logging program. The other for a shared data file that I could
- update when the programs reading it were down.
-
- These are only stopgaps. Ways of getting a non-network program (or programmer)
- going on a LAN with minimal trouble. Doing things *right* takes a lot more.
-
- --
- Leonard Erickson leonard@qiclab.scn.rain.com
- CIS: [70465,203] 70465.203@compuserve.com
- FIDO: 1:105/51 Leonard.Erickson@f51.n105.z1.fidonet.org
- (The CIS & Fido addresses are preferred)
-