User manual

Section 9: Files Series 3700 System Switch/Multimeter Reference Manual
9-14 3700S-901-01 Rev. C / July 2008
io.read()
Function
Reads data from the default input file.
Usage
data = io.read(format)
data: The data read from the file. The number of return values matches the number of
values in format.
format: A string or number indicating the type of data to be read. Any number of
format parameters may be passed to this command, each corresponding to a returned
data value. Optional; default is "*l".
Remarks
The format parameters may be any of the following:
"*n": Return a number.
"*a": Return the whole file, starting at the current position; return an empty string at the
end of file.
"*l": Return the next line, skipping the end of line; return nil at the end of file.
n: Return a string with up to n characters; return an empty string if n is zero; return
nil at the end of file.
Any error encountered is logged to the error queue.
io.type()
Function
Checks whether obj is a valid file handle.
Usage
io.type(obj)
Remarks
Returns "file" if obj is an open file handle, "closed file" if obj is a closed file handle,
and nil if obj is not a file handle.
io.write()
Function
Buffer data until a flush (file:flush() (on page 9-10) or io.flush()
(on page 9-12)) or close (file:close() (on page 9-10) or io.close() (on
page 9-12)) operation is performed.
NOTE Data may be lost if the file is not flushed or closed before the application
ends. A write buffers the data until a flush or close operation is requested.
Usage
io.write(data)
data: The data to write to the file. An arbitrary number of data values may be passed
to this command. All parameters must be either strings or numbers.
Remarks
Any error encountered is logged to the error queue.