EasyManuals Logo

Tektronix KEITHLEY 2600B Series User Manual

Tektronix KEITHLEY 2600B Series
834 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #416 background image
Series 2600B System SourceMeter® instrument Reference Manual Section 9: TSP command reference
2600BS-901-01 Rev. F/August 2021 9-95
Example
local fileName = "/usb1/myfile.txt"
if fs.is_file(fileName) then
os.remove(fileName)
print("Removing file")
else
print("Nothing removed")
end
print("\n*** fileVar:close")
do
myfile, myfile_err, myfile_errnum = io.open(fileName, "w")
myfile:write("Line 1")
myfile:close()
end
myfile, myfile_err, myfile_errnum = io.open(fileName, "r")
myfile:close()
os.remove(fileName)
Opens file myfile.txt for writing. If no errors were found while opening, writes Removing file and closes
the file.
Also see
fileVar:flush() (on page 9-95)
fileVar:read() (on page 9-96)
fileVar:seek() (on page 9-98)
fileVar:write() (on page 9-99)
io.close() (on page 9-117)
io.open() (on page 9-119)
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.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Tektronix KEITHLEY 2600B Series and is the answer not in the manual?

Tektronix KEITHLEY 2600B Series Specifications

General IconGeneral
BrandTektronix
ModelKEITHLEY 2600B Series
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals