As noted already, ENDFILE marks the end of a file, at its current
position. You should look at POSITION='APPEND' in the OPEN statement.
That is supposed to open the file with position after the last record
written, and before any endfile mark that may exist, so that you could
append records. Then BACKSPACE could be used.
Dick Russell
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf
Of Ben Blackwell
Sent: Saturday, October 22, 2005 9:44 AM
To: [log in to unmask]
Subject: end of input
F90 Group:
I have a need to extract the last nine records of an input file when I
do not know (at least conveniently) the total number of records in the
file. I thought I could use ENDFILE (UNIT) followed by BACKSPACE(UNIT)
over the nine records. However, this seems to wipe out the contents of
the input file. The open statement for the file is of the form:
OPEN(UNIT=KINP,FILE='file_name',STATUS='OLD')
Any suggestions would be appreciated.
Thanks,
Ben Blackwell
-----------------------------------------
*****************Internet Email Confidentiality
Footer******************
Privileged/Confidential Information may be contained in this message.
If you are not the addressee indicated in this message (or responsible
for delivery of the message to such person), you may not copy or
deliver
this message to anyone. In such case, you should destroy this message
and notify the sender by reply email. Please advise immediately if you
or your employer do not consent to Internet email for messages of this
kind. Opinions, conclusions and other information in this message that
do not relate to the official business of The Shaw Group Inc. or its
subsidiaries shall be understood as neither given nor endorsed by it.
_______________________________________________________________________
_
The Shaw Group Inc.
http://www.shawgrp.com
|