22 file functions, 1 openfile() – Teledyne LeCroy SierraFC Verification Script Engine Reference Manual User Manual

Page 50

Advertising
background image

Verification Script Engine Reference Manual

45

22 File functions


This group of functions covers VSE capabilities to work with the external files.

22.1 OpenFile()

This function opens file for writing.


Format :

OpenFile( file_path, append )



Parameters:

file_path - the full path to the file to open. ( For ‘\’ use ‘\\’ )

append - this parameter ( if present and not equal to 0 ) specifies that VSE should append
following write operations to the contents of the file – otherwise, the contents of the file will be
cleared.


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” ); # opens file, the previous contents will be

# erased.


WriteString( file_handle, “Some Text1” ); # write text string to file
WriteString( file_handle, “Some Text2” ); # write text string to file

CloseFile( file_handle ); # closes file

# opens file, the following file operations will append to the contents of the file.

file_handle = OpenFile( GetApplicationFolder() + “Log.txt”, _APPEND );

Advertising