OpenRead

Top  Previous  Next

The OpenRead function opens a text file for reading. If the file is opened successfully, the File Number is returned. If the file does not exist, the function returns false or zero. The file can then be read using the ReadLine function.

 

If a colon is included in the path, then the path is literal and used as is, so you can open any file in any folder. If a colon is not included, then the path is relative to the Trading Blox directory. If a // is included, then the path is literal so you can access any file on any folder on any server.

 

If the file name includes a colon, then the file name is considered a full path, and that full path will be used.

If the file name starts with \\ then the file name is considered a full path to a server location.

If the file name does not contain a colon or \\, then the file name is considered relative to the main Trading Blox folder.

 

Syntax

 

fileNumber = fileManager.OpenRead( fileName )

 

Parameters

fileName

 

the name of the file to open

 

 

 

returns

 

File Number if successful, zero if not successful.

 

Example

' Open the file.

IF fileManager.OpenRead( "C:\FileToOpen.txt" ) THEN

   PRINT "File Opened Successfully"

ENDIF

 

or

 

' Open the file.

fileNumber = fileManager.OpenRead( "C:\FileToOpen.txt" )

 

IF fileNumber > 0 THEN

   PRINT "File Number", fileNumber, "Opened Successfully"

ENDIF