Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to go to the end of the file?

Tags:

fortran

I have opened a file to write a number. I have to write the number at the end of the file so

how to go to the last line to write on it?

like image 714
user1944005 Avatar asked Jan 02 '13 21:01

user1944005


1 Answers

You should open the file with

open(..., position="append",...)

Alternatively, you can inquire for the size of the file

inquire(...,size=some_integer_variable,...)

then if the file is a direct access file, you can use this size to calculate the record number of the final record. Alternatively, if the access mode is "stream", you can use

write(..., pos=some_integer_variable)

to write starting at the end of the file.

like image 140
janneb Avatar answered Nov 12 '22 14:11

janneb