Git Product home page Git Product logo

Comments (3)

hennink avatar hennink commented on August 19, 2024 1

"Modern fortran explained" (Metcalf et al., 2011) lists descriptions of the dummy variables of the inquire statement. I didn't read everything, but this is probably the entry you're looking for:

named=nmd and name= nam, where nmd is a logical variable that is assigned the value
true if the file has a name, and false otherwise. If the file has a name, the character
variable nam will be assigned the name. This value is not necessarily the same as that
given in the file specifier, if used, but may be qualified in some way. However, in
all cases it is a name which is valid for use in a subsequent open statement, and so
the inquire can be used to determine the actual name of a file before connecting it.
Whether the file name is case sensitive is system dependent

It migh tbe worth adding the iomsg dummy variable to both the open and the inquire procedures, and print iomsg if istat /= 0.

from pyplot-fortran.

jacobwilliams avatar jacobwilliams commented on August 19, 2024

Tried to use the STATUS='SCRATCH' feature of the OPEN statement. However, it doesn't appear to be possible to get the name of the file with gfortran. For example:

 program Test

    implicit none

    integer :: istat,iunit
    character(len=256) :: fname

    open(newunit=iunit,status='SCRATCH',iostat=istat)
    inquire(unit=iunit,name=fname,iostat=istat)

    write(*,*) 'name = '//trim(fname)

 end program Test

When compiled with gfortran, fname is just garbage. Might be a bug? It works on ifort. Will look into it some more.

from pyplot-fortran.

hennink avatar hennink commented on August 19, 2024

And this is the explanation of the status argument:

status= st, where st is a character expression that provides the value old, new, replace,
scratch, or unknown. The file= specifier must be present if new or replace is
specified or if old is specified and the unit is not connected; the file= specifier must
not be present if scratch is specified.

(...)
If the value scratch is specified, the file is created and becomes
connected, but it cannot be kept after completion of the program or execution of a
close statement.

I suppose this all makes sense: a scratch file does not have to be accessible though a filename by the OS.

from pyplot-fortran.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.