From:	CSBVAX::MRGATE!saganich%frodo.decnet@mghccc.harvard.edu@SMTP 29-MAY-1988 04:49
To:	ARISIA::EVERHART
Subj:	testing if a file is open from pascal


Received: from mghccc.harvard.edu by KL.SRI.COM with TCP; Thu 26 May 88 10:00:44-PDT
Date: 26 May 88 13:03:00 EST
From: "FRODO::SAGANICH" <saganich%frodo.decnet@mghccc.harvard.edu>
Subject: testing if a file is open from pascal
To: "info-vax" <info-vax@kl.sri.com>
Reply-To: "FRODO::SAGANICH" <saganich%frodo.decnet@mghccc.harvard.edu>

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 <stdio.h>
#include <descrip.h>

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.
------
