Series 2600B System SourceMeter® instrument Reference Manual Section 9: TSP command reference
2600BS-901-01 Rev. F/August 2021 9-99
Also see
io.open() (on page 9-119)
fileVar:write()
This function writes data to a file.
Usage
fileVar:write(data)
fileVar:write(data1, data2)
fileVar:write(data1, ..., datan)
The file descriptor variable
Write all data to the file
The first data to write to the file
The second data to write to the file
The last data to write to the file
One or more entries (or values) separated by commas
Details
This function may buffer data until a flush (fileVar:flush() or io.flush()) or close
(fileVar:close() or io.close()) operation is performed.
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*** fileVar:write")
myfile, myfile_err, myfile_errnum = io.open(fileName, "w")
do
myfile:write("Line 1")
end
myfile:close()
os.remove(fileName)