From: Preeti on
Hi

Can anyone tell how to capture the output of "call system" in a
variable other than writing into a file and reading?

TIA
-preeti
From: glen herrmannsfeldt on
Preeti <preeti.malakar(a)gmail.com> wrote:

> Can anyone tell how to capture the output of "call system" in a
> variable other than writing into a file and reading?

In Unix/C, you use popen() and read the resulting stream.

That is a little harder in Fortran, and I believe technically
not allowed in C interoperability, but sometimes it works.

-- glen
From: feenberg on
On Mar 3, 2:09 pm, Preeti <preeti.mala...(a)gmail.com> wrote:
> Hi
>
> Can anyone tell how to capture the output of "call system" in a
> variable other than writing into a file and reading?
>
> TIA
> -preeti

In Unix, the "mknod p" command (try "man mknod") might help you out -
it would eliminate the actual disk I/O but you would still use fortran
input statements to read the information.

It might go something like this (not tested):

call system('mknod p filenode')
call system('ls >filenode&')
open(unit=10,file='filenode', status='unknown')
read(10,'(a80)') line

Where the mknod command creates a node into which the ls command
writes as
the read statement reads from it. The OS handles the write/read
interlock - notice that the ls command runs in background.

Daniel Feenberg