Thread View: comp.lang.fortran
3 messages
3 total messages
Started by Petros Dafniotis
Mon, 25 Jan 1993 15:19
Help with UNIX f77 file buffer system
Author: Petros Dafniotis
Date: Mon, 25 Jan 1993 15:19
Date: Mon, 25 Jan 1993 15:19
22 lines
1530 bytes
1530 bytes
Hello netters,
I know very little about UNIX (in fact I am using VMS for almost 9yrs now).
A friend of mine had the following problem:
"His program (all written in FORTRAN by 1-2 people years ago) takes quite
some time to finish. He is writing info produced at
run time to 2-3 output files. However, 90% of the runs are proved to be
useless quite soon; so he uses CTRL-C to abort execution. But then he finds
no info in the output files. I am guessing that the UNIX file buffer system
still keeps these numbers in the buffer and what he needs is to flush the
buffers after each single write. Could someone tell me how can this be
accomplished in UNIX? (he is using HP-RISC and SUN SPARC-I workstations)."
I would appreciate any help/comments (replies either by e-mail or in the
news are fine). Thank you,
Petros Dafniotis
Chem Engr Dept, UW-Madison
e-mail: dafnioti@cae.wisc.edu
PS: I managed to do that by using really a C function to do all open/fprintf/
fflush/close commands. But I would prefer a FORTRAN way (if possible).
Re: Help with UNIX f77 file buffer system
Author: System Admin (Mike Peterson)
Date: Mon, 25 Jan 1993 16:17
Date: Mon, 25 Jan 1993 16:17
24 lines
1938 bytes
1938 bytes
In article <1993Jan25.091937.5738@doug.cae.wisc.edu> dafnioti@cae.wisc.edu (Petros Dafniotis) writes: >Hello netters, > > I know very little about UNIX (in fact I am using VMS for almost 9yrs now). >A friend of mine had the following problem: >"His program (all written in FORTRAN by 1-2 people years ago) takes quite >some time to finish. He is writing info produced at >run time to 2-3 output files. However, 90% of the runs are proved to be >useless quite soon; so he uses CTRL-C to abort execution. But then he finds >no info in the output files. I am guessing that the UNIX file buffer system >still keeps these numbers in the buffer and what he needs is to flush the >buffers after each single write. Could someone tell me how can this be >accomplished in UNIX? (he is using HP-RISC and SUN SPARC-I workstations)." Try the 'flush' routine from the BSD F77 library (it should be in HP-UX 9.0, but is not in HP-UX 8.07); Sun has had that library for ages. If you are stuck at 8.07, write a C routine that calls fflush after using FSTREAM (see p. 9-30 of the FORTRAN manual) to get the C "FILE *" pointer. This approach will not work on stdin/stdout/stderr at 8.07, but works fine on other unit numbers. -- core error - bus dumped -*- Mike Peterson, SysAdmin, U/Toronto Chemistry ******* As usual, I speak only for me, myself and I; nobody else ******* E-mail: system@alchemy.chem.utoronto.ca Tel: (416)978-7094 Fax: (416)978-8775
Re: Help with UNIX f77 file buffer system
Author: Ken Bell
Date: Tue, 26 Jan 1993 05:15
Date: Tue, 26 Jan 1993 05:15
12 lines
947 bytes
947 bytes
In <1993Jan25.091937.5738@doug.cae.wisc.edu> dafnioti@cae.wisc.edu (Petros Dafniotis) writes: >no info in the output files. I am guessing that the UNIX file buffer system >still keeps these numbers in the buffer and what he needs is to flush the >buffers after each single write. Could someone tell me how can this be >accomplished in UNIX? (he is using HP-RISC and SUN SPARC-I workstations)." Why not catch SIGINT (see signal(3C)) and simply close() all files before exiting? -- Ken Bell (kenbell@panix.com -or- syklb@nasagiss.giss.nasa.gov)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads