Section 9: TSP command reference Series 2600B System SourceMeter® instrument Reference Manual
9-124 2600BS-901-01 Rev. F/August 2021
Details
All data parameters must be either strings or numbers.
Data is not immediately written to a file when you use the io.write() function. The io.write()
function buffers data; it may not be written to the USB flash drive immediately. Use the io.flush()
function to immediately write buffered data to the drive.
Example
local fileName = "/usb1/myfile.txt"
if fs.is_file(fileName) then
os.remove(fileName)
print("Removing file")
else
print("Nothing removed")
end
errorqueue.clear()
print("\n*** io.write")
myfile, myfile_err, myfile_errnum = io.open(fileName, "w")
myfile:write("Line 1")
myfile:close()
do
fileHandle = io.output(fileName)
io.write("Line 2")
end
io.close(fileHandle)
os.remove(fileName)
Writes data to the default output file.
Also see
io.flush() (on page 9-118)