User manual
Section 9: Files  Series 3700 System Switch/Multimeter Reference Manual 
9-12  3700S-901-01 Rev. C / July 2008 
file: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 function buffers the data until a flush or close operation is 
requested. 
Usage 
file:write(data) 
file: The descriptor of the file. 
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. 
This command is not remotely accessible. 
io.close() 
Function 
Closes the specified file. 
Usage 
io.close(file) 
file: A file descriptor to flush and close 
Remarks 
This command is equivalent to file:close() (on page 9-10). 
io.flush() 
Function 
Flush the buffered data for the current output file. 
Usage 
io.flush() 
Remarks 
Use this command to flush data written to the current default file by file:write() 
(on page 9-11) or io.write() (on page 9-14). Using this command removes the 
need to close a file after writing to it and allows it to be left open to write more data. 
Data may be lost if the file is not closed or flushed before an application ends. To 
prevent the loss of data if there is going to be a time delay before more data is written 
when you want to keep file open and not close it, flush the file after writing to it. 
io.input() 
Function 
Assigns a previously opened file, or opens a new file, as the default input file. 
Usage 
io.input(filein) 
fileout = io.input() 
filein: A file descriptor to assign or the path of a file to open as the default input file. 
The path may be absolute or relative to the current working directory. This parameter 
is optional; if absent, the command returns the absolute path to the current default 
input file (fileout). 
fileout: The absolute path to the default input file. 










