Section 9: TSP command reference Series 2600B System SourceMeter® instrument Reference Manual
9-122 2600BS-901-01 Rev. F/August 2021
local fileName = "/usb1/myfile.txt"
if fs.is_file(fileName) then
os.remove(fileName)
print("Removing file")
else
print("Nothing removed")
end
errorqueue.clear()
-- io.read
print("\n*** io.read")
myfile, myfile_err, myfile_errnum = io.open(fileName, "w")
myfile:write("Line 1\n")
myfile:flush()
myfile:close()
do
fileHandle = io.input(fileName)
value = io.read("*a")
print(value)
end
fileHandle:close()
print(errorqueue.next())
Read data from the default input file.
Also see
None
io.type()
This function checks whether or not a given object is a file handle.
Usage
type = io.type(obj)
Indicates whether the object is an open file handle
Details
Returns the string "file" if the object is an open file handle. If it is not an open file handle, nil
is returned.