Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!umd5!purdue!decwrl!ucbvax!MGHCCC.HARVARD.EDU!saganich%frodo.DECnet From: saganich%frodo.DECnet@MGHCCC.HARVARD.EDU ("FRODO::SAGANICH") Newsgroups: comp.os.vms Subject: testing if a file is open from pascal Message-ID: <8805281145.AA07683@ucbvax.Berkeley.EDU> Date: 26 May 88 18:03:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: "FRODO::SAGANICH" Organization: The Internet Lines: 56 Hi Infovaxers, I am in a situation where I need to test whether a file is open for write by another users. If so I would like to wait until I can open it. Pascal doesn't seem to have any sort of is_it_already_open type of procedure. What I was going to do is call c and use the access function. However, this doesn't seem to really fit the bill either. As such I have two questions 1) What langauge/function can I use to test if a file is already open? If none exist has someone already written something that I could take a look at? 2) Any ideas why the following blurb of code results in an access violation?? Thanks in advance for any help Al Saganich, systems analyst. MGH boston Ma. saganich%frodo.decnet@mghccc.harvard.edu /****************** cut here, is_it_open.c ********************/ #include #include is_it_open(str_ptr) struct dsc$descriptor *str_ptr; { printf("the length is %d\n",str_ptr->dsc$w_length); printf("the string is %s\n",str_ptr->dsc$a_pointer); } {--------------- cut here combine.pas -----------------------} program combine (input,output); type string = varying [100] of char; var test_str:string; status:integer; [EXTERNAL] function Is_it_open(str:string):integer; extern; begin test_str :='THIS IS A TEST STRING'; status := is_it_open(test_str); end. ------