8: TSP command reference Model 2450 Interactive SourceMeter® Instrument
8-58 2450-901-01 Rev. B/September 2013
file.close()
This function closes a file on the USB flash drive.
Type TSP-Link accessible
Affected by Where saved Default value
Usage
file.close(fileNumber)
The file number from file open command to close
Details
Note that files are automatically closed when the file descriptors are garbage collected.
The root folder of the USB flash drive has the following absolute path:
"/usb1/"
Example
file_num = file.open("/usb1/SWEEPTRIGGER", file.MODE_WRITE)
file.close(file_num)
Open the file SWEEPTRIGGER for writing, then close it.
Also see
file.open() (on page 8-59)
file.flush()
This function writes buffered data to a file.
Type TSP-Link accessible
Affected by Where saved Default value
Function No
Usage
file.flush(fileNumber)
The file number from file open command of the file to flush
Details
The file.write() function buffers data, which may not be written immediately to the USB flash drive. Use
file.flush() to flush this data. Using this function removes the need to close a file after writing to it, which
allows 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
None