Article View: comp.sys.sun
Article #11469Problem with Fortan system(3F) and open files
From: Jonathan Eisenhamer
Date: Sat, 11 Mar 1989 06:45
Date: Sat, 11 Mar 1989 06:45
51 lines
2013 bytes
2013 bytes
To All Spots,
A problem has been noted with the procedure system(3F) in fortran. Below
is an example program + input file. The problem is that all opened files
are truncated as soon as a call to system(3F) is made. For the program
below, the first line is read, the system call is made, and when the
second line read is attempted, it ends on the EOF statement. If the
system call is removed, it works fine. If system(3F) is replaced with a
call to a C routine which just calls system(3), the program also works
fine.
Stdin, etc, are also affected. This can be seen by removing the open
statement and changing the "read (20..." to "read( *..." and performing
the command: "cat testinput | a.out"
Is this a known bug with system(3F)? or is this a "feature"? This is
under 3.5SunOs.
Thanks for your time,
Jonathan Eisenhamer
jon@astro.ucla.edu
jon@uclastro.bitnet
bonnie::jon (span 5.708)
__________
program fd
character*40 line
open( 20, file='./testinput' )
call system( 'echo "We are calling the system"' )
10 read(20, '(a)', end=999, err=900) line
write( *, * ) line
call system( 'echo "We are calling the system"' )
goto 10
900 continue
write( *, * ) 'It errored out.'
999 continue
write( *, * ) 'File is closing.'
close( 20 )
end
__________ file ./testinput
This is line 1
this is line 2
this is line 3
this is line 4
this is line 5
Technical Details
Message-ID:
<8903011840.AA17159@mira.astro.ucla.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ukma!husc6!rice!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ukma!husc6!rice!sun-spots-request From: jon@astro.ucla.edu (Jonathan Eisenhamer) Newsgroups: comp.sys.sun Subject: Problem with Fortan system(3F) and open files Keywords: Software Message-ID: <8903011840.AA17159@mira.astro.ucla.edu> Date: 11 Mar 89 06:45:24 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 51 Approved: Sun-Spots@rice.edu Original-Date: Wed, 1 Mar 89 10:40:10 PST X-Sun-Spots-Digest: Volume 7, Issue 193, message 16 of 18