How to read a file?

How to prevent a text file being read over and over again in FORTRAN?

  • I have written a code in which a text file is to be read to store quite a few values in various arrays. This is being done in a certain subroutine which is being called multiple times from another program. As the call is made multiple times, the text file is read again and again which makes the execution very slow. Is there a way of avoiding multiple reading of the same data from the text file. I have tried to use SAVE attribute, but I see an error that the arrays are automatic objects and they can't be declared with a SAVE attribute. I can't read the file in a separate subroutine and use COMMON block to make the data available because I get a similar error. I have also tried to use a logical switch which would allow the file to be read once but on second call I lose the previously read values. Can anyone advise on this matter. Thanks.

  • Answer:

    d

mnafk at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.