Continuous output to a file instead of buffer storage? 
Author Message
 Continuous output to a file instead of buffer storage?

I am trying to run some long-running programs on a Sparc station.
Right now, I am using a Sparc 3 (levelland.cs).  I am trying to
figure how to cause *every* bit of output to go ahead and go to
the output file instead of waiting until the program is completely
done.  Someone has suggested using something similar to the
'setbuf' command used in C like this:

  setbuf (stdout, NULL);        /* output one word at a time */

so that each character is immediately written to the output file (in
this case standard output), instead of buffering it.  I have looked
at a textbook on fortran 77 and I can't seem to find anything related
to this in there.

Any ideas?

                        Thanks,
                            Eva S. Simmons

--
***THE SIMMONS FACTOR ****EVA SABRINA SIMMONS******UT-AUSTIN GRAD STUDENT*****

         WWW Personal Page:   http://www.*-*-*.com/ ~weevey
****************** WATCH IT, OR IT MIGHT ATTACK!! ****************************



Wed, 27 Aug 1997 09:31:00 GMT  
 Continuous output to a file instead of buffer storage?
I haven't used a Sparc, but I've been up against the same thing on other
machines.  Fortran really isn't made for this kind of thing.  In the old
days (maybe even today on some systems) there was a performace hit each
time data actually goes to the output, hence holding stuff in buffers.  
You could be up against the operating system or the Fortran I/O system.

Console output does go immediately, but only at the end of each record,
not each character.

One thing I have done is to close the file each time I wanted to flush
the buffer, then re-open it with access='append'.  Clunky, and you've got
to put the close/open pair each place you need it, but it does work.

Ken Plotkin



Thu, 28 Aug 1997 10:39:29 GMT  
 Continuous output to a file instead of buffer storage?

: I am trying to run some long-running programs on a Sparc station.
: Right now, I am using a Sparc 3 (levelland.cs).  I am trying to
: figure how to cause *every* bit of output to go ahead and go to
: the output file instead of waiting until the program is completely
: done.  Someone has suggested using something similar to the
: 'setbuf' command used in C like this:

:   setbuf (stdout, NULL);      /* output one word at a time */

: so that each character is immediately written to the output file (in
: this case standard output), instead of buffering it.  I have looked
: at a textbook on FORTRAN 77 and I can't seem to find anything related
: to this in there.

Hi Eva,

You just have to write a small C routine with this setbuf command
and call this routine from your FORTRAN code.  Here's the actual C
routine I used for that purpose.

/*
        This routine sets the I/O buffer to 0 character.
                FORTRAN Call:  K = bufset()
*/

#include <stdio.h>

int
bufset_()
{
   setbuf(stdout, (char*)0);

   return(0);

Quote:
}

Hope this helps.
Jeff


Fri, 29 Aug 1997 04:49:12 GMT  
 Continuous output to a file instead of buffer storage?

Quote:


>: I am trying to run some long-running programs on a Sparc station.
>: Right now, I am using a Sparc 3 (levelland.cs).  I am trying to
>: figure how to cause *every* bit of output to go ahead and go to
>: the output file instead of waiting until the program is completely
>: done.  Someone has suggested using something similar to the
>: 'setbuf' command used in C like this:

>:   setbuf (stdout, NULL);  /* output one word at a time */

>: so that each character is immediately written to the output file (in
>: this case standard output), instead of buffering it.  I have looked
>: at a textbook on FORTRAN 77 and I can't seem to find anything related
>: to this in there.

>You just have to write a small C routine with this setbuf command
>and call this routine from your FORTRAN code.  Here's the actual C
>routine I used for that purpose.

snip-snip-snip

You may also want to try the system function "flush" callable directly from
FORTRAN, as described in this SUN Solaris manual page:

NAME
     flush - flush output to a logical unit

SYNOPSIS
     subroutine flush (lunit)

DESCRIPTION
     The flush subroutine flushes the contents of the buffer  for
     logical  unit  lunit  to  the associated file.  This is most
     useful for logical units 0 and 6 when they are both  associ-
     ated with the control terminal.

We use it to flush all of our formatted output files and it appears to work
fairly well. Obviously, this command is not portable (although some vendors do
provide this same function, eg. SGI, DEC, Convex), so beware when porting to
other OS's (eg. HP-UX, AIX).

Hope this helps.

Ian



Sat, 30 Aug 1997 01:57:31 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Flushing last records of output file buffer?

2. g77: how can I flush the file output buffer

3. File output buffer overrun?

4. rxvt + python problem: script output buffered and interactive output missing

5. continuous sound output without breaks?

6. Continuous audio output with varying volume or frequency

7. synchronous continuous acquisition and output with two cards

8. Synthesis - 2 Inverters instead of a buffer

9. analog level triggering of storage with trigger output

10. File (original) To File Copy (storage)

11. DLL-File instead of EXE-File?

12. creating linux so files instead of dll files

 

 
Powered by phpBB® Forum Software