OpenFile

Top  Previous  Next

 

OpenFile

 

Syntax

OpenFile([in] FileName, [in] FileAccess, [in] FileID);

 

Description

To open a file for reading/writing. You must close the file using FSCommand CloseFile for every file you opened.

 

Parameters

       FileName

               The name of the file to open.

       FileAccess

               The file open access. The following values are supported:

                       "r" = File is opened for reading

                       'w' = File is opened for writing

                       'a' = File is opened for appending

       FileID

               The file index to open. You can open maximum 10 files at once. For each file, you need to nominate a file ID to represent this                file in the subsequent file access to this file. FileID is ranging from 0.. 9

 

Return

       1 = success

       0 = failed

       -1 = FSCommands cannot be found

 

Example

 

FSCommand("OpenFile", "C:\\Test.dat,w,0");

 

This will open file c:\test.dat for writing and assign it a file index 0