This function block of the ⇘ CAA_File.library 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.
Input:
xExecute |
BOOL |
see: ⇘ “CAA 指南” |
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 |
Output:
xDone |
BOOL |
see: ⇘ “CAA 指南” |
xBusy |
BOOL |
see: ⇘ “CAA 指南” |
xError |
BOOL |
see: ⇘ “CAA 指南” |
eError |
FILE.ERROR |
Error ID |
hFile |
CAA.HANDLE |
File handle |