iostat
Daniel Franke
franke.daniel@gmail.com
Tue Aug 22 20:07:00 GMT 2006
Hi all.
I tried to work out a way to provide meaningful error messages besides "open
failed". While checking iostat, I found it VERY difficult to distiguish
between different errors, ENOENT and EACCESS for example. Both iostat numbers
are simply '1':
$> ls
iostat.f90
$> cat iostat.f90
PROGRAM test_iostat
INTEGER :: ierr
OPEN(UNIT = 42, FILE = "file", ACTION = "READ", STATUS = "OLD", IOSTAT=ierr)
WRITE (*,*) ierr
END PROGRAM
$> gfortran-4.1.1 -g -Wall iostat.f90
$> ./a.out
1
$> touch file
$> ./a.out
0
$> chmod 0 file
$> ./a.out
1
Removing the IOSTAT clause results in
Fortran runtime error: No such file or directory
and
Fortran runtime error: Permission denied
respectively.
If I am not completely mistaken, the numbers returned in "ierr"
should be distinguishable?
Regards
Daniel
P.S. Related thread in comp.lang.fortran:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/a9d9bffdce73d9cd/
More information about the Fortran
mailing list