Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.
Most generally, you will have to then capture the output of the command to a file, and
read that back in. You can using C interop to directly access such
commands, but this is going to be system specific.o
Cheers, David Duffy.
On Wednesday, September 1, 2021 at 8:38:58 AM UTC-7, HCorte wrote:
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.
There is EXECUTE_COMMAND_LINE which will execute anything that is normally executable.
On Wednesday, September 1, 2021 at 4:53:09 PM UTC-7, David Duffy wrote:As mentioned, you can execute a system command:
(snip)
Most generally, you will have to then capture the output of the command to a file, andWell if you are doing that, might as well call popen().
read that back in. You can using C interop to directly access such commands, but this is going to be system specific.o
Cheers, David Duffy.
(But yes, it will still be system specific.)
Though it would be better to have a real Fortran equivalent to popen().
In the Fortran 77 days, with HP-UX, I did manage to use popen().
HP-UX Fortran (at least used to) have a way to connect a Unix file descriptor to a Fortran unit. I had a program do the popen() and then
return the fd, for the Fortran program to use. That was so I could
spool directly to lpr.
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.Are you by any chance using OpenVMS?
On 9/1/2021 9:38 AM, HCorte wrote:
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.Are you by any chance using OpenVMS?
Louis
A quinta-feira, 2 de setembro de 2021 à(s) 04:58:31 UTC+1, Louis Krupp escreveu:
On 9/1/2021 9:38 AM, HCorte wrote:
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.Are you by any chance using OpenVMS?
LouisYes Louis using OpenVMS sorry didn't provide the OS before, is EXECUTE_COMMAND_LINE specific to Unix,Linux or does it also work in OpenVMS?
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.If you are recovering information from the external procedure, isn't the important part of the question how to execute an external procedure then wait for it to complete before proceeding?
On Thursday, September 2, 2021 at 1:38:58 AM UTC+10, HCorte wrote:
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.If you are recovering information from the external procedure, isn't the important part of the question how to execute an external procedure then wait for it to complete before proceeding?
You need to know when the results of the "command procedure" are available before proceeding.
This can be the messy part, such as testing for a file to be created, unless this is an option in EXECUTE_COMMAND_LINE ?
On 9/2/21 8:30 PM, JCampbell wrote:
On Thursday, September 2, 2021 at 1:38:58 AM UTC+10, HCorte wrote:
Is it possible to call a command procedure in fortran? and if so obtain a variable/symbol of the command procedure.If you are recovering information from the external procedure, isn't the important part of the question how to execute an external procedure then wait for it to complete before proceeding?
You need to know when the results of the "command procedure" are available before proceeding.
This can be the messy part, such as testing for a file to be created, unless this is an option in EXECUTE_COMMAND_LINE ?
There is a WAIT option and some status arguments.
Dick Hendrickson
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 230 |
Nodes: | 16 (2 / 14) |
Uptime: | 52:43:25 |
Calls: | 4,911 |
Calls today: | 8 |
Files: | 11,508 |
Messages: | 3,971,718 |
Posted today: | 1 |