This function block opens an already existing file or creates a new one. The return value is a file handle, which can then be used as an input ”hFile” in the function blocks File.Read, File.Write, File.Close. There may be restrictions concerning the specification of the directory name, e.g. only capital letters allowed, for different targets. The function File.GetProperty shows these restrictions.
Inputs:
xExecute
|
BOOL |
|
sFileName |
CAA.FILENAME |
Directory name: No special characters, Separator for sub-directories “/”, Absolute or relative path specifications No empty spaces Use capital letters |
eFileMode |
FILE.MODE |
Mode in which the file should be opened, FILE.MWRITE: - Write access; file will be overwritten or created FILE.MREAD: - Read access; file will be opened for reading only FILE.MRDWR: - Read- and write access; the file will be overwritten or created FILE.MAPPD: - File will be opened in WRITE mode, but the written data will be appended at the end of the file |
xExclusive |
BOOL |
File access mode: TRUE: exclusive data access FALSE:multiple data access possible |
Outputs:
xDone
|
BOOL |
|
xBusy |
BOOL |
|
xError |
BOOL |
|
eError |
FILE.ERROR |
Error ID |
hFile |
CAA.HANDLE |
File handle |