Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Spanky Deluxe

macrumors 603
Original poster
Mar 17, 2005
5,293
1,839
London, UK
Is there a simple way to write to the display at the same time as writing to a disk?

I've just been putting together a quick program to scan through some data and have written it so that it spits out everything to the screen using write(*,*) commands.

I'd like it to create a dump of this stuff to a file too. Obviously, I could just go through and duplicate every write command but is there a simpler more elegant way to do it?
 
Nothing Fortran-specific, but:
tee will allow you to write to a file while displaying to the screen, so you could run your program through that.

You could also: write directly to a file, but fork and exec tail -f on that file when you start, but after the file is created.

-Lee

Edit: also, write(*,*)? so lazy! =) Fortran is an odd choice for a quick parse script. Might be time to learn a little perl.
 
Along the lines of what lee1210 posted, why don't you wrap the Fortran binary in a 2-line shell script using tee or tail.

Crackpip
 
Nothing Fortran-specific, but:
tee will allow you to write to a file while displaying to the screen, so you could run your program through that.

You could also: write directly to a file, but fork and exec tail -f on that file when you start, but after the file is created.

-Lee

Edit: also, write(*,*)? so lazy! =) Fortran is an odd choice for a quick parse script. Might be time to learn a little perl.

Yeah tee will work but ideally this will be off running on a cluster so I'd like to keep it as internal as possible. The rest of my code's in Fortran so I'm used to using it. I'm normally dealing with equations and stuff not input/output so I'm a bit rusty on that and write(*,*) and write(*,linenumber) with a format string does the job on the whole.

Along the lines of what lee1210 posted, why don't you wrap the Fortran binary in a 2-line shell script using tee or tail.

Crackpip

I might just do that. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.