DirRename (FB; Prefix fildrn) ¶ FUNCTION_BLOCK DirRename EXTENDS CBM.ETrig This function block can be used to rename a directory and is optional for the different targets. Contrary to the original CAA specification the directory may be renamed even if it is opened via ”FILE. DirOpen ”. This behavior is dependent of the underlying operating system and file system. Whether this function block is implemented or not is explicitly stated and encoded in the return value of the function ”FILE. GetProperty ”. It is not recommended to use this function block to move files (it may work but is system dependent). Please use the appropriate function block ”FILE. Rename ” instead. InOut: Scope Name Type Comment Input sDirNameOld CAA.FILENAME Old directory name sDirNameNew CAA.FILENAME New directory name Output eError ERROR Local library error ID (0: no error; 5101: time out)
File ¶ Close (FunctionBlock) Copy (FunctionBlock) Delete (FunctionBlock) EOF (FunctionBlock) Flush (FunctionBlock) GetAttribute (FunctionBlock) GetPos (FunctionBlock) GetSize (FunctionBlock) GetTime (FunctionBlock) Open (FunctionBlock) Read (FunctionBlock) Rename (FunctionBlock) SetPos (FunctionBlock) Write (FunctionBlock)
Close (FB; Prefix filcl) ¶ FUNCTION_BLOCK Close EXTENDS CBM.ETrig This function block terminates the file access, i.e. closes the file. InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle Output eError ERROR Local library error ID (0: no error; 5101: time out)
Copy (FB; Prefix filcp) ¶ FUNCTION_BLOCK Copy EXTENDS CBM.ETrigToA This function block copies a file. The target file is created or - if already existent - overwritten. The overwrite mode can be defined with the input ” xOverWrite ”. If the overwrite mode is activated, no write protection may be activated in the existing file. The function block is optional for different targets. Whether this function block is implemented or not is explicitly stated and encoded in the return value of the function ”FILE. GetProperty ”. InOut: Scope Name Type Initial Comment Input sFileNameDest CAA.FILENAME File to which data should be copied; for restrictions concerning the file- and directory names see FILE_Open (FB) sFileNameSource CAA.FILENAME File from which data should be copied, for restrictions concerning the file- and directory names see FILE_Open (FB) xOverWrite BOOL TRUE Overwrite an already existing file; TRUE: yes; FALSE: File will not be overwritten, an error message will be created Output eError ERROR Local library error ID (5105 - FILE_EXIST: Target file already exists; only in case of xOverWrite := FALSE ) szSize CAA.SIZE source file size, copied bytes into the destination file
Delete (FB; Prefix fildl) ¶ FUNCTION_BLOCK Delete EXTENDS CBM.ETrig This function block deletes a file. Contrary to the original CAA specification the file may be deleted even if it is opened via ”FILE. Open ”. This behavior is dependent of the underlying operating system and file system. InOut: Scope Name Type Comment Input sFileName CAA.FILENAME Name of the file to be deleted Output eError ERROR Local library error ID (0: no error; 5101: time out)
EOF (FB; Prefix fileof) ¶ FUNCTION_BLOCK EOF EXTENDS CBM.ETrig This function block sets “xEOF” to “TRUE” if the current offset is equal to the end of the file. If the end of the file has not yet been reached, “FALSE” is returned. InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle Output eError ERROR Local library error ID (0: no error; 5101: time out) xEOF BOOL End of file is reached, TRUE: yes, FALSE: no
Flush (FB; Prefix filfl) ¶ FUNCTION_BLOCK Flush EXTENDS CBM.ETrig Flush write buffer of an opened file to disk. InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle Output eError ERROR Local library error ID (0: no error; 5101: time out)
GetAttribute (FB) ¶ FUNCTION_BLOCK GetAttribute EXTENDS CBM.ETrig With this function block file attributes can be obtained. InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle Output eError ERROR Local library error ID (0: no error; 5101: time out) eFileAttrib ATTRIB File attributes, FILE_ARCHIVE, FILE_HIDDEN, FILE_NORMAL, FILE_READONLY
GetPos (FB; Prefix filgp) ¶ FUNCTION_BLOCK GetPos EXTENDS CBM.ETrig This function block returns the offset position currently set in the file. The file must be opened via FILE. Open . InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle Output eError ERROR Local library error ID (0: no error; 5101: time out) udiPos __UXINT Offset position; Number of bytes from the start of the file
GetSize (FB; Prefix filgs) ¶ FUNCTION_BLOCK GetSize EXTENDS CBM.ETrig This function block returns the size of the file specified by “ sFileName “. InOut: Scope Name Type Comment Input sFileName CAA.FILENAME File name Output eError ERROR Local library error ID (0: no error; 5101: time out) szSize CAA.SIZE Actual file size in bytes