How can I run an executable from within a FORTRAN code?
-
Is there a command I can use in FORTRAN programming that will run another executable? I am using Compaq Visual Fortran with windows, and I also compile the code on a linux box. I would like the commands for both. The other executable will be located in the same folder as the written program.
-
Answer:
Just as the other answerer said: you have to rely on what is known as a system call, the specifics details may depend on your compiler. Basically, this is your program launching another program just as if you entered the command in a shell tool. What you need to check for, however, is that usually the calling program will be suspended until the called one is completed; if you want to run concurrently, you need to use a run detach modifier, like the "&" of Unix/Linux. The other thing to watch for is that, unless you establish inter-process communication yourself, the two programs do not talk with one another; so you have the second program put its answer in some intermediate file, with a signal for the first program, if you need to transfer information across.
Soulagen... at Yahoo! Answers Visit the source
Other answers
It's somewhat bad practice, but if you know what you are doing it would be something like: program name: myProg call system('./myProg') !< Call another executable It's just a call to the system subroutine. It should work on windows, but not guaranteeing it since I don't have a windows Fortran compiler other than under MinGW / Cygwin
Jared
Related Q & A:
- How can I echo characters before and after a string?Best solution by stackoverflow.com
- How can I run all my selenium tests sequentially in C#?Best solution by Stack Overflow
- How can I send an http request at a specific time?Best solution by Stack Overflow
- How can I run CMD command?Best solution by Super User
- How can I run faster?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.