Openfile() - LeCroy USB Protocol Suite Reference Manual

Verification script engine
Table of Contents

Advertisement

LeCroy Corporation

18.1 OpenFile()

This function opens a file for writing.
Format:
OpenFile(file_path, append, mode)
Parameters:
file_path
append
mode
Return Values:
The "handle" to the file to be used in other file functions.
Example:
...
set file_handle = 0;
...
file_handle = OpenFile("D:\\Log.txt");
...
WriteString(file_handle, "Some Text1"); # Write text string to file.
WriteString(file_handle, "Some Text2"); # Write text string to file.
...
CloseFile(file_handle);
...
# Opens file in text mode.
# The following file operations append to the contents of the file.
file_handle = OpenFile(GetApplicationFolder() + "Log.txt", _APPEND);
# Opens file in binary mode. The previous contents are erased.
file_handle = OpenFile("D:\\data.bin", 0, _FO_BINARY);
...
Write(file_handle, 0xAABBCCDD); # Writes integer value into the binary file.
CloseFile(file_handle);
Full path to the file to open. (For '\' use '\\')
This parameter (if present and not equal to 0) specifies that VSE should append
the following write operations to the contents of the file; otherwise, the
contents of the file are cleared.
This parameter specifies the open mode (text or binary) for the file.
If omitted, text mode is used. It can be one of the following values:
_FO_BINARY (= 0): Opens file in binary mode
_FO_TEXT
(= 1): Opens file in text mode (by default)
Verification Script Engine Reference Manual
# Opens file in text mode.
# The previous contents
# are erased.
# Closes the file.
# Closes the binary file.
Page 83 of 107

Advertisement

Table of Contents
loading

Table of Contents