- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like I have to investigate whether the GIS program can link to the file without locking it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like I have to investigate whether the GIS program can link to the file without locking it.
We use Manifold as well, and as far as I know, Maniold locks a file when it links to it. That's why you get the sharing violation. It would be neat to find a way around it.
What I normally do is: Set up a table in Manifold with the same format as your csv file. Link a drawing to that table. I use Crimson Editor as a text editor that does not lock a file, so my code can overwrite it while it's open in Crimson. I cut-and-paste updated data from the text editorinto the table in Manifold (once cleared). Then refresh the drawing. This approach got a few extra steps in it, but I find it still faster than re-linking the csv file every time, or close and reopen Manifold, so it will release the csv file for overwrtiting.
How do you write your CSV files in Fortran though? I'm having a hard time figuring that out. Are there any code examples / references around online?
Thanks, Chris

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page