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 #419 background imageLoading...
Page #419 background image
Section 9: TSP command reference Series 2600B System SourceMeter® instrument Reference Manual
9-98 2600BS-901-01 Rev. F/August 2021
fileVar:seek()
This function sets and gets the present position of a file.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function
No
Usage
position, errorMsg = fileVar:seek()
position, errorMsg = fileVar:seek("whence")
position, errorMsg = fileVar:seek("whence", offset)
position
The new file position, measured in bytes from the beginning of the file
errorMsg
A string containing the error message
fileVar
The file descriptor variable
whence
A string indicating the base against which offset is applied; the default is "cur"
offset
The intended new position, measured in bytes from a base indicated by whence
(default is 0)
Details
The whence parameters may be any of the following:
"set": Beginning of file
"cur": Current position
"end": End of file
If an error is encountered, it is logged to the error queue, and the command returns nil and the
error string.
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:seek")
myfile, myfile_err, myfile_errnum = io.open(fileName, "w")
myfile:write("Line 1")
myfile:close()
do
myfile, myfile_err, myfile_errnum = io.open(fileName, "r")
position = myfile:seek("end", -1)
print(position)
end
myfile:close()
os.remove(fileName)
Get the present position of a file.

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