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.064123.8890@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>
- Date: Tue, 12 Jan 1993 06:41:23 GMT
- Lines: 52
-
- ppollet@cismibm.univ-lyon1.fr (Patrick POLLET) 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 )
-
- You need it for append also! I know!
-
- > The standard value is 02 that is ReadWrite with no share support.
- > The actual value should be created from the following table:
- > OPEN MODE
- > bit 7 1 if file private to process, 0 if child may use it
- > 6,5,4 : Sharing Mode as follow:
- > 000 compatible mode (no share)
- > 001 deny Read/write
- > 010 deny Write
- > 101 deny read
- > 100 deny none
- > 3 always 0
- > 2,1,0 : Acces mode
- > 000 Read
- > 001 Write
- > 010 Read write
- >
- >to get some share support you should set FileMode to:
- > - $42 open for Read/Write AND Deny NONE
- > - $22 open for Read/Write AND Deny write by others...
- > all whatever valid combination...
-
- > INFO TAKEN FROM the Dos lan juncture by J.S.Haugdahk
- > PC TECH JOURNAL JULY 1987 ,p 78-89
- > An execellent article that explains all MsDos-Share
- > entry points, with entry points, return values...
-
- > 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 *)
-
- Nope, you need to open it for *read* and *write* since Append requires
- both. And to avoid problems you need to restrict the {$I-} to as small
- a portion of the program as possible.
-
- I wish I had my code, but it's at my last job.
- --
- 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)
-