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
|
|
0
|
|
|
|
Reply
|
Preeti
|
3/3/2010 7:09:30 PM |
|
Preeti <preeti.malakar@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
|
|
0
|
|
|
|
Reply
|
glen
|
3/3/2010 7:57:21 PM
|
|
On Mar 3, 2:09=A0pm, Preeti <preeti.mala...@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=3D10,file=3D'filenode', status=3D'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
|
|
0
|
|
|
|
Reply
|
feenberg
|
3/8/2010 2:57:00 PM
|
|