pefv700@perv.pe.utexas.edu (06/30/91)
The FORTRAN statement INQUIRE(UNIT, name = STRING) sets STRING to the name of the file that the FORTRAN logical unit UNIT refers to. How can this be implemented under UNIX with system calls? (Yeah, I know this is not strictly a FORTRAN question. Just wanting to know how to implement it myself.) Thanks, Chris
morreale@bierstadt.scd.ucar.edu (Peter W. Morreale) (06/30/91)
In article <51447@ut-emx.uucp> pefv700@perv.pe.utexas.edu writes: > >The FORTRAN statement > > INQUIRE(UNIT, name = STRING) > >sets STRING to the name of the file that the FORTRAN logical unit UNIT >refers to. > >How can this be implemented under UNIX with system calls? % man 2 stat > >(Yeah, I know this is not strictly a FORTRAN question. Just wanting to know >how to implement it myself.) > It's not a Fortran question in any sense. Please post to comp.lang.c. -PWM -- ------------------------------------------------------------------ Peter W. Morreale email: morreale@ncar.ucar.edu Nat'l Center for Atmos Research voice: (303) 497-1293 Scientific Computing Division
sjc@borland.com (Steve Correll) (07/01/91)
In article <51447@ut-emx.uucp> pefv700@perv.pe.utexas.edu writes: > >The FORTRAN statement > > INQUIRE(UNIT, name = STRING) > >sets STRING to the name of the file that the FORTRAN logical unit UNIT >refers to. > >How can this be implemented under UNIX with system calls? In the straightforward case, where a previous OPEN statement specified an explicit file name, the Fortran runtime system may remember the name and give it back to you when you execute the INQUIRE. In less straightforward cases (such as a preconnected file) the behavior varies with the implementation; the Fortran 77 standard is deliberately vague with respect to "files", and can even be implemented on a machine without a conventional file system. (As you observe, Unix system calls like "stat" do not let you map from file descriptor to file name--some file descriptors map to no name, and others map to more than one name, due to hard links.)