
Section 7: TSP command reference
2606B System SourceMeter® Instrument Reference Manual
7-90
2606B-901-01 Rev. B / May 2018
fileVar:flush()
This function writes buffered data to a file.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function
No
Usage
fileVar
:flush()
fileVar
The file descriptor variable to flush
Details
The
fileVar
:write()
or
io.write()
functions buffer data, which may not be written immediately
to the USB flash drive. Use
fileVar
:flush()
to flush this data. Using this function removes the
need to close a file after writing to it, allowing the file to be left open to write more data. Data may be
lost if the file is not closed or flushed before a script ends.
If there is going to be a time delay before more data is written to a file, and you want to keep the file
open, flush the file after you write to it to prevent loss of data.
Also see
(on page 7-92)
(on page 7-109)
(on page 7-111)
fileVar:read()
This function reads data from a file.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function
No
Usage
data1
=
fileVar
:read()
data1
=
fileVar
:read(
format1
)
data1
,
data2
=
fileVar
:read(
format1
,
format2
)
data1
, ...,
datan
=
fileVar
:read(
format1
, ...,
formatn
)
data1
First data read from the file
data2
Second data read from the file
datan
Last data read from the file
fileVar
The descriptor of the file to be read
format1
A string or number indicating the first type of data to be read
format2
A string or number indicating the second type of data to be read
formatn
A string or number indicating the last type of data to be read
...
One or more entries (or values) separated by commas
Details
The format parameters may be any of the following:
"*n"
: Returns a number.