For Programmers: Free Programming Magazines  


Home > Archive > Fortran > October 2004 > Mutual file sharing with 2 or more CVF files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Mutual file sharing with 2 or more CVF files
justabeginner

2004-10-11, 8:56 pm

Hello all. I've been trying to get 2 CVF programs to interface with
each other through shared text files.

Basically:
1) Program 1 writes some data to a text file;
2) Program 1 executes Program 2 through the systemqq('Program2.exe')
command;
3) Program 2 reads the text file (in theory)
4) Program 2 modifies the text file (in theory)
5) Program 1 re-reads the modified text file.

Unfortunately I get this error:

"forrtl: The process cannot access the file because it is being used
by another process."

and I think it is because of a sharing violation between the 2
programs. Since the programs don't need to access the files
simultaneously (they access it in turn) how do I get these 2 programs
to work?

Also, is there a way of directly transferring the output of one
program into the input of another (without shared files, etc)?

Thanks
beliavsky@aol.com

2004-10-11, 8:56 pm


nom_de_plume79@yahoo.co.uk (justabeginner) wrote:
>Hello all. I've been trying to get 2 CVF programs to interface with
>each other through shared text files.
>
>Basically:
>1) Program 1 writes some data to a text file;
>2) Program 1 executes Program 2 through the systemqq('Program2.exe')
>command;
>3) Program 2 reads the text file (in theory)
>4) Program 2 modifies the text file (in theory)
>5) Program 1 re-reads the modified text file.
>
>Unfortunately I get this error:
>
>"forrtl: The process cannot access the file because it is being used
>by another process."
>
>and I think it is because of a sharing violation between the 2
>programs. Since the programs don't need to access the files
>simultaneously (they access it in turn) how do I get these 2 programs
>to work?


In Program 1, after writing to the file in step 1, CLOSE the file.

>
>Also, is there a way of directly transferring the output of one
>program into the input of another (without shared files, etc)?


Use a pipe, a concept well-known in Unix but also available on DOS/Windows.
If your executables are 1.exe and 2.exe, typing

1.exe | 2.exe

uses the standard output of 1.exe as input to 2.exe .



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
justabeginner

2004-10-13, 3:56 am

Hi beliavsky. Thanks for your input. I implemented the close
statements into my DO loop and everything works perfectly.

Good idea about the pipe, I'll look into it. Do you know if it is
possible to have an iterative pipe where prog1.exe & prog2.exe
continuously return data to each other? It looks like if you invoke a
pipe at the command prompt it would be a one-off thing.

Thanks.
meek@skyway.usask.ca

2004-10-13, 3:59 pm

In a previous article, nom_de_plume79@yahoo.co.uk (justabeginner) wrote:
>Hi beliavsky. Thanks for your input. I implemented the close
>statements into my DO loop and everything works perfectly.
>
>Good idea about the pipe, I'll look into it. Do you know if it is
>possible to have an iterative pipe where prog1.exe & prog2.exe
>continuously return data to each other? It looks like if you invoke a
>pipe at the command prompt it would be a one-off thing.
>
>Thanks.

I wonder if you could set up a handshake - e.g. the || port
could be accessed by both programs and (SPP anyway) is
read/write - that each program can use to signal the other
that data are ready in file xxxx. Tricky - but entertaining.
Chris
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com