Re: Write position



Bokgae <worn76@xxxxxxxxx> wrote:

I'd like to write the number of data at the beginning
of the result file.

I tried the following code
===============================
NCOUNT = 0
DO N = 1, 1000000000, 1
NCOUNT = NCOUNT + 1
RESULT( N ) = some calculations
WRITE( 99, * ) RESULT( N )
IF( RESULT( N ) > 10. ) EXIT
ENDDO
REWIND( 99 )
WRITE( 99, * ) NCOUNT
===============================
but the result shows NCOUNT only without any RESULT( N )

Yes, that is how sequential files work. Even if it
didn't rewrite the EOF it still isn't likely it would
work, as with list directed write different records would
have different length.

One common way, use for example by PDF files, is to
put the information at the end. Programs reading
the file fseek() (C library function) to the end of
the file, fseek() back until they find the table of
contents, which then tells where all the pages are.

If you really want it at the beginning, about the
only way is to use direct access files. That usually
requires fixed record length, which you may be able
to do.

-- glen

.