Welcome to Intel® Software Network Quick Login | Join | Help |
Search in Intel® Software Network Forums
in Go

WRITE to an existing file that another program has linked to - possible?

Last post 05-15-2008, 9:04 PM by david_spurr. 3 replies.
Sort Posts: Previous Next
 05-15-2008, 7:41 PM 30254931  

WRITE to an existing file that another program has linked to - possible?

One of my programs outputs a file in .csv format.  Each run completely re-writes the file (basic structure of the file remains constant).  The open statement is of the form:

OPEN (fileNum, file = 'Hazard.csv', iostat=ios)

While debugging, I want to view the contents of 'Hazard.csv' in a GIS program as the easiest way to quickly assess whether the output is correct.

In the GIS program (Manifold) I have a Table linked to 'Hazard.csv'.  The Table in the GIS program is linked to a Drawing layer displayed in a Map.  An alternative would be to have the Drawing directly linked to 'Hazard.csv', but 'Hazard.csv' does not contain any Latitude & Longitude data.  (FWIW, I find the GIS program a very powerful debugging aid  in many situations).

Ideally, I would like to leave the GIS program open, with the link to 'Hazard.csv' live, so that after running my Fortran program, I could go straight to my GIS program & view what changes had occurred.  Since there may be 'many' iterations during the debugging process, it would help if I can run the Fortran program while link from the GIS program is still open.

However, if I attempt this I get an error message indicating that the Fortran program cannot write to 'Hazard.csv' (same as the message I get if I have the file open in Excel). 

Is there anyway around this?  ie. anyway to force a write (overwrite) of a file that is open or linked to by another program?

Part of the objective with linked files in the GIS program is to allow external programs to modify the data externally & have the changes show up in the GIS program. 

 
 05-15-2008, 8:27 PM 30254932 in reply to 30254931  

Re: WRITE to an existing file that another program has linked to - possible?

David,

I suspect that both processes are attempting to open the file for exclusive access.  You could try SHARE='DENYNONE' in your open statement.  Obviously, this leaves you vulnerable to corrupting the file, as both programs could write to the file at any time.  If the GIS program has already opened the file exclusively, you may still not be able to open the file from your program.

Regards, David

 
 05-15-2008, 8:50 PM 30254933 in reply to 30254932  

Re: WRITE to an existing file that another program has linked to - possible?

Thanks, David

Still not able to write the file though, so possibly the problem is at the GIS program end.

I just hoped there was a way to force the overwrite from within the Fortran program (as that is under my control)


 
 05-15-2008, 9:04 PM 30254934 in reply to 30254933  

Re: WRITE to an existing file that another program has linked to - possible?

Yes, I just tried opening the file in Excel & got a message saying the file was locked for editing by 'another user'.  Offered 'Read only' access. 

Looks like I have to investigate whether the GIS program can link to the file without locking it.

 
View as RSS news feed in XML

Shortcuts


Tags For This Post

...

Community Tags

...