User manual

Series 3700 System Switch/Multimeter Reference Manual Section 9: Files
3700S-901-01 Rev. C / July 2008 9-11
file:read()
Function
Reads data from a file.
Usage
data = file:read(format)
data: The data read from the file. The number of return values matches the number of
values in format.
file: The descriptor of the file to read.
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. The format attribute is optional; the 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 the empty string at
the end of the 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.
This command is not remotely accessible.
file:seek()
Function
Sets and gets a file's current position.
Usage
position = file:seek(whence, offset)
position: The new file position, measured in bytes from the beginning of the file.
file: The descriptor of the file.
whence: A string indicating the base against which offset is applied. The whence
attribute is optional; the default is "cur".
offset: The intended new position, measured in bytes from a base indicated by
whence. Optional, default is 0.
Remarks
The whence parameters may be any of the following:
"set": Beginning of file.
"cur": Current position.
"end": End of file.
If an error is encountered, it is logged to the error queue, and the command returns
nil and the error string.
This command is not remotely accessible.