FUNCTION_BLOCK Open EXTENDS CBM.ETrig
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.Write”, ”FILE.Read”, ”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.
InOut:
|
Scope
|
Name
|
Type
|
Comment
|
Input
|
sFileName
|
CAA.FILENAME
|
File name, absolute or relative path specification
|
eFileMode
|
MODE
|
File mode: FILE_MWRITE - write, FILE_MREAD - read, FILE_MRDWR - read & write, FILE_MAPPD - append
|
xExclusive
|
BOOL
|
UNSUPPORTED PARAMETER: IS ALWAYS FALSE!
|
Note: Because of the POSIX behaviour of the file open functions on targets, there is no way to support xExclusive=TRUE! If a file still is opened, it can be deleted or renamed at the same time! Additionally a file can be opened several times (for reading and writing).
|
|
Output
|
eError
|
ERROR
|
Local library error ID (0: no error; 5101: time out)
|
hFile
|
CAA.HANDLE
|
File handle
|
|