![background image](http://html2.mh-extra.com/html/keithley/2657a/2657a_reference-manual_4007750418.webp)
Model 2657A High Power System SourceMeter® Instrument Reference Manual
Section 7: TSP command reference
2657A-901-01 Rev. B/December 2012
7-105
Usage
fileVar
= io.input()
fileVar
= io.input(
newfile
)
fileVar
The descriptor of the input file or an error message (if the function fails)
newfile
A string representing the path of a file to open as the default input file, or the
file descriptor of an open file to use as the default input file
Details
The
newfile
path may be absolute or relative to the current working directory.
When using this function from a remote TSP-Link
®
node, this command does not accept a file descriptor and
does not return a value.
If the function fails, an error message is returned.
Also see
(on page 7-105)
io.open()
This function opens a file for later reference.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function No
Usage
fileVar, errorMsg
= io.open(
path
)
fileVar, errorMsg
= io.open(
path, mode
)
fileVar
The descriptor of the opened file
errorMsg
Indicates whether an error was encountered while processing the
function
path
The path of the file to open
mode
A string representing the intended access mode (
"r"
= read,
"w"
= write, and
"a"
= append)
Details
The path to the file to open may be absolute or relative to the current working directory. If you successfully open
the file,
errorMsg
is nil and
fileVar
has the descriptor that can be used to access the file.
If an error is encountered, the command returns
nil
for
fileVar
and an error string.
Example
testFile, testError = io.open("testfile.txt", "w")
if testError == nil then
testFile:write("This is my test file")
io.close(testFile)
end
Opens file
testfile.txt
for
writing. If no errors were found
while opening, writes
"This is
my test file"
and closes the
file.
Also see
Содержание 2657A
Страница 3: ......