Returns an expression containing status information about a specified file unit.
INFO, /Structures, FSTAT(0)
** Structure FSTAT, 10 tags, 32 length:
UNIT | LONG | 0 |
NAME | STRING | 'stdin' |
OPEN | BYTE | 1 |
ISATTY | BYTE | 1 |
READ | BYTE | 1 |
WRITE | BYTE | 0 |
TRANSFER_COUNT | LONG | 0 |
CUR_PTR | LONG | 8112 |
SIZE | LONG | 0 |
REC_LEN | LONG | 0 |
NAME The name of the file.
OPEN Nonzero if the file unit is open. If
OPEN
is 0, the remaining fields in FSTAT contain no useful information.ISATTY Nonzero if the file is actually a terminal instead of a normal file.
READ Nonzero if the file is open for read access.
WRITE Nonzero if the file is open for write access.
TRANSFER_COUNT The number of scalar data items transferred in the last I/O operation on the unit. This is set by the following routines: READ, READF, READU, PRINT, PRINTF, and WRITEU.
TRANSFER_COUNT is useful when you are attempting to recover from input/output errors.
CUR_PTR The current position of the file pointer, given in bytes from the start of the file. If the device is a terminal (
ISATTY
is nonzero), the value of CUR_PTR
will not contain useful information.SIZE The current length of the file, in bytes. If the device is a terminal (
ISATTY
is nonzero), the value of SIZE
will not contain useful information.REC_LEN OpenVMS-specific record length, in bytes. This field is always zero under UNIX and Windows.
FUNCTION read_data, file
OPENR, /Get_Lun, unit, file
status = FSTAT(unit)
data = FLTARR(status.size / 4.0)
status
; gives the number of bytes in the file and single-precision
; floating-point values are four bytes each.
READU, unit, data
FREE_LUN, unit
RETURN, data
END
herc.dat
exists and contains 10 floating-point values, the following statements:
a = read_data('herc.dat')
herc.dat
.
INFO, a
A | FLOAT | = Array(10) |
For more information, see Getting Information About Files in Chapter 8 of the PV-WAVE Programmer's Guide.
For background information, see Logical Unit Numbers (LUNs) in Chapter 8 of the PV-WAVE Programmer's Guide.