home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8062 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.6 KB  |  64 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!spool.mu.edu!uwm.edu!rpi!batcomputer!cornell!uw-beaver!news.tek.com!psgrain!qiclab!leonard
  3. From: leonard@qiclab.scn.rain.com (Leonard Erickson)
  4. Subject: Re: File locking question
  5. Message-ID: <1993Jan12.064123.8890@qiclab.scn.rain.com>
  6. Reply-To: Leonard.Erickson@f51.n105.z1.fidonet.org
  7. Organization: SCN Research/Qic Laboratories of Tigard, Oregon.
  8. References: <Hendrik.Klompmaker.31.726184187@beheer.zod.wau.nl> <ppollet.118.726255594@cismibm.univ-lyon1.fr>
  9. Date: Tue, 12 Jan 1993 06:41:23 GMT
  10. Lines: 52
  11.  
  12. ppollet@cismibm.univ-lyon1.fr (Patrick POLLET) writes:
  13.  
  14. >        If you want your files to be "SHAREABLE" you should fiddle with the 
  15. >FileMode public variable of TurboPascal BEFORE doing any Reset,Rewrite,
  16. >Close (and possibly Append :I did not tried that one yet )
  17.  
  18. You need it for append also! I know!
  19.  
  20. >    The standard value is 02 that is ReadWrite with no share support.
  21. >    The actual value should be created from the following table:
  22. >            OPEN  MODE
  23. >    bit    7   1 if file private to process, 0 if child may use it
  24. >           6,5,4 : Sharing Mode as follow:
  25. >                     000   compatible mode (no share)
  26. >                     001   deny Read/write
  27. >                     010   deny Write
  28. >                     101   deny read
  29. >                     100   deny none
  30. >            3   always 0   
  31. >            2,1,0 : Acces mode
  32. >                      000 Read 
  33. >                      001 Write
  34. >                      010 Read write 
  35. >                     
  36. >to get some share support you should  set FileMode to:
  37. >   - $42     open for Read/Write AND Deny NONE
  38. >   - $22     open for Read/Write AND Deny write by others...
  39. >    all whatever valid combination...
  40.  
  41. >  INFO TAKEN FROM  the Dos lan juncture by J.S.Haugdahk 
  42. >                   PC TECH JOURNAL  JULY 1987 ,p 78-89 
  43. >                   An execellent article that explains all MsDos-Share
  44. >                    entry points, with entry points, return values...
  45.  
  46. > So my guess  is that your program username should:
  47.  
  48. >  -be compiled with $I-  (no stop on runtime error)
  49.  
  50. >  -Repeat
  51. >     -try to open the file in mode $11 (Write and deny ALL)
  52. >  -Until (IoResult=0)  (* nobody else has locked it *)
  53.  
  54. Nope, you need to open it for *read* and *write* since Append requires
  55. both. And to avoid problems you need to restrict the {$I-} to as small
  56. a portion of the program as possible.
  57.  
  58. I wish I had my code, but it's at my last job. 
  59. -- 
  60. Leonard Erickson              leonard@qiclab.scn.rain.com
  61. CIS: [70465,203]             70465.203@compuserve.com
  62. FIDO:   1:105/51     Leonard.Erickson@f51.n105.z1.fidonet.org
  63. (The CIS & Fido addresses are preferred)
  64.