Object functions and properties allow the importing and exporting of data by way of external files.  Multiple files can be opened at the same time, and there are additional File & Disk Functions functions available that support task associated with working with data on the disk and its various sub-directory folders.  

 

When parameter stepping threads are active,  the FileManager has  thread safe protections.  

The number of open files is increased from 100 to 400.  However, watch out for Windows limit on concurrent open files.

 

Functions:

Description:

Close()

Closes an open file.

CountLines()

Returns the number of lines in the file. Takes the file number as a parameter

DefaultFolder

Returns the default folder used by the file manager for locating files. This is also the main Trading Blox folder

EndOfFile() or EOF()

Returns TRUE if the end of the file is reached

OpenAppend()

The OpenAppend function opens a text file for writing. If the file already exists, the file will be opened for writing at the end of the file and any previous information will not be erased.

OpenRead()

Opens a file for reading

OpenWrite()

Opens a file for writing

PartialLine

Returns TRUE if the entire line was not read fully by ReadLine

ReadLine()

Reads a line from a file into a string variable

WriteLine()

Writes a string to the file appending a new line character

WriteString()

Writes a string to the file without a new line character

 

Notes:

See string functions GetField for use in parsing the input from files.  See GetFieldCount for discovering the number of comma seperated fields in the record.

 

If you are opening multiple files be sure to save the File Numbers into BPV Integer Variables for use in other areas of the module.

If you save a File-Number in a temp Local variable, then it will be lost once you leave the script section.

Normally one would open the files in the Before Test script and close in the After test script. The BPV Integer File Number variables can then be used to read and write from the various files at the same time. When using the OpenAppend function the file can be closed and opened multiple times during the test, since the writing will always be appended to the end of the file.

 

Links:

File & Disk Functions, GetField, GetFieldCount

See Also:

 


Edit Time: 11/7/2020 3:42:05 PM


Topic ID#: 107

 

 

 

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software