caputering IO in python

David Bolen db3l at fitlinxx.com
Thu Aug 24 15:46:06 EDT 2000


Curtis Jensen <cjensen at bioeng.ucsd.edu> writes:

> Maybe I should have stated this earlier, but I'm running on IRIX 6.5,
> not a windows machine.  I've built a shared object file that has Fortran
> objects and a C object in it.  The python calls the C and the C calls
> the Fortran.  No seperate executables anywhere.  Thanks.

I'm not that familiar with Fortran under Unix, but assuming that the
Fortran compiler uses the same standard underlying Unix file handles
for its "standard output", you should be able to open a new file or
pipe, and then dup2() the new handle onto handle 1 (stdout) and/or 2
(stderr) to redirect the Fortran module output.  dup() the old
descriptor first if you want to restore things afterwards.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list