Re: Is it possible to invoke a Unix command within Fortran 90 source code?
- From: garylscott@xxxxxxxxxxxxx
- Date: Thu, 7 Feb 2008 07:12:55 -0800 (PST)
On Feb 7, 7:55 am, "Craig Dedo" <cd...@xxxxxxxxx> wrote:
"Arjen Markus" <arjen.mar...@xxxxxxxxxx> wrote in message
On 7 feb, 12:02, hermitian <iamwu...@xxxxxxxxx> wrote:
I know it is pretty easy to invoke a Unix command within C code, but
it seems that no textbook has mentioned to invoke a Unix command
within Fortran code. So the question is "is it possible or not?"
Thank you in advance!
Yes, but it depends on your compiler. Most define some
function or subroutine like system() that allows you to
run an external command or program.
But it is not part of the standard, so you will have to
check the manual of your compiler and be prepared to
change the relevant code if you use another one.
FWIW, Fortran 2008 will have a standard suboutine EXECUTE_COMMAND_LINE of
EXECUTE_COMMAND_LINE( COMMAND, WAIT, EXITSTAT, CMDSTAT, CMDMSG )
COMMAND is a scalar variable of type default character and its value is the
command line to be executed.
WAIT is an optional scalar variable of type default logical and
determines whether the command operates synchronously or asynchronously.
EXITSTAT is an optional scalar variable of type default integer and is
assigned the value of the exit status if the command is executed synchronously.
CMDSTAT is an optional scalar variable of type default integer and is
assigned values that represent the completion status of the subroutine.
CMDMSG is an optional scalar variable of type character and is assigned a
processor-dependent error message of an error occurs.
J3 paper 05-240r4 contains a complete description of this subroutine.
I have no idea whether any current Fortran compilers have any plans to
include the Fortran 2008 EXECUTE_COMMAND_LINE subroutine in versions in the near
Don't like the overly verbose spelling, but wonderful...on windows,
need a value that specifies whether an annoying DOS box flashes on the
screen or not as the command is processed. By default, in most
implementations, a command prompt window is opened prior to execution
of a command regardless of whether the command writes anything or not
to the window. This can be suppressed through an API call, but it is
extremely annoying when not desired.
17130 W. Burleigh Place
P. O. Box 423
Brookfield, WI 53008-0423
Voice: (262) 783-5869
Fax: (262) 783-5928
Mobile: (414) 412-5869
E-mail: <cd...@xxxxxxxxx> or <cr...@xxxxxxxxxx>- Hide quoted text -
- Show quoted text -
- Prev by Date: Re: Is it possible to invoke a Unix command within Fortran 90 source code?
- Next by Date: Re: Help with USE 'variable' visibility
- Previous by thread: Re: Is it possible to invoke a Unix command within Fortran 90 source code?
- Next by thread: Re: Is it possible to invoke a Unix command within Fortran 90 source