home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8063 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.4 KB  |  56 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.064806.9011@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> <1993Jan5.220346.24647@csx.cciw.ca>
  9. Date: Tue, 12 Jan 1993 06:48:06 GMT
  10. Lines: 44
  11.  
  12. u055@csx.cciw.ca (James Sprenger) 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. >I don't think this will work 'cause the file that is accessed is
  19. >redirected from the command line, and not initialized from the TP prog. 
  20. >Even if you did open the file from the TP program, I think you'll run into
  21. >problems when two people try to write to the file simultaneously (spelling?)
  22. >Any how, if you are using a Novell NetWare network, its probably best to
  23. >use semaphores...these netware function are faaaast and you don't have to
  24. >write your own lowlevel IO routines. 
  25.  
  26. Nope! Novell *has* to support the share operations. And it does. I wrote
  27. a program that did it this way. *much* simpler than semaphores for a short
  28. program. 
  29.  
  30.  
  31. >> So my guess  is that your program username should:
  32. >>
  33. >>  -be compiled with $I-  (no stop on runtime error)
  34. >>
  35. >>  -Repeat
  36. >>     -try to open the file in mode $11 (Write and deny ALL)
  37. >>  -Until (IoResult=0)  (* nobody else has locked it *)
  38. >>
  39.  
  40. >I tried a similar routine with an app I was writing and never quite got it to
  41. >work.  Maybe I should look at it again....
  42.  
  43. It *will* work. As long as you onl;y want one process at a time using the file.
  44. I've gotten it to work with DenyAll-Read/Write, and with DenyNone-ReadOnly. 
  45. The first for a logging program. The other for a shared data file that I could
  46. update when the programs reading it were down.
  47.  
  48. These are only stopgaps. Ways of getting a non-network program (or programmer)
  49. going on a LAN with minimal trouble. Doing things *right* takes a lot more.
  50.  
  51. -- 
  52. Leonard Erickson              leonard@qiclab.scn.rain.com
  53. CIS: [70465,203]             70465.203@compuserve.com
  54. FIDO:   1:105/51     Leonard.Erickson@f51.n105.z1.fidonet.org
  55. (The CIS & Fido addresses are preferred)
  56.