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
GetTime (FB; Prefix filgt) ¶ FUNCTION_BLOCK GetTime EXTENDS CBM.ETrig This function block returns date and time of the last modification 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) dtLastModification DT Date and time of last modification, for example dt#2006-05-08-00:00:00
Open (FB; Prefix filop) ¶ 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
Read (FB; Prefix filrd) ¶ FUNCTION_BLOCK Read EXTENDS CBM.ETrigToA This function block reads the file, which was previously opened via ”FILE. Open ”. If less characters can be read than specified in ” szBuffer ”, the function block returns an active ” xDone ” and indicates the current number of characters in ” szSize ”. The size of the target memory structure for the bytes to be read and the number of bytes to be read will not be checked. If the stability of the pointer on the data structures and their contents cannot be guaranteed in case of an online change, an online change must be avoided. InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle pBuffer CAA.PVOID Target address for the first byte to be read; can be retrieved via operator ADR szBuffer CAA.SIZE Maximum number of bytes to be read; can be retrieved via operator sizeof Output eError ERROR Local library error ID (0: no error; 5101: time out) szSize CAA.SIZE Current number of successfully read bytes; this value is already valid before xDone has been set
Rename (FB) ¶ FUNCTION_BLOCK Rename EXTENDS CBM.ETrig This function block modifies the file name and is optional for the different targets. Contrary to the original CAA specification the file may be renamed even if it is opened via ”FILE. Open ”. 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 ”. The function block cannot be used to move directories! InOut: Scope Name Type Comment Input sFileNameOld CAA.FILENAME Old file name sFileNameNew CAA.FILENAME New file name Output eError ERROR Local library error ID (0: no error; 5101: time out)
SetPos (FB) ¶ FUNCTION_BLOCK SetPos EXTENDS CBM.ETrig This function block modifies the current offset for a file access. The file must be opened via FILE. Open . InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle udiPos __UXINT Offset position, Number of bytes from the start of the file Output eError ERROR Local library error ID (0: no error; 5101: time out)
Write (FB; Prefix filwr) ¶ FUNCTION_BLOCK Write EXTENDS CBM.ETrigToA This function block writes data into the file, which was previously opened via ”FILE. Open ”. The contents of the memory area indicated by pointer ” pBuffer ” should not be modified during the write action! The size of the structure of the memory containing the bytes to be written as well as the number of bytes to be written will not be checked. If the stability of the pointer on the data structures and their contents cannot be guaranteed in case of an online change, an online change must be avoided with the help of functions from the ”CAA_Application library”. InOut: Scope Name Type Comment Input hFile CAA.HANDLE File handle pBuffer CAA.PVOID The address from where the data can be obtained, can be determined with the help of operator ADR . szSize CAA.SIZE Number of bytes to be written (can be determined via operator SIZEOF ) Output eError ERROR Local library error ID (0: no error; 5101: time out)
Functions ¶ GetProperty (Function)
GetProperty (FUN) ¶ FUNCTION GetProperty : DWORD This function provides information on target-specific settings and functionalities, which concern the file or directory system or the implementation of optional function blocks. Properties table Nr. Constant name Meaning Return value function block – support 1 FILE_gc_PDIRRENAME Support of function block FILE_DirRename 0: No 1: Yes 2 FILE_gc_PRENAME Support of function block FILE_Rename 0: No 1: Yes 3 FILE_gc_PCOPY Support of function block FILE_Copy 0: No 1: Yes 4 FILE_gc_PSETATTRIBUTE Support of function block FILE_SetAttribute 0: No 1: Yes Restrictions on directories and files 100 FILE_gc_PFILENAME83 Restriction of the directory and file names to 8.3 format 0: No 1: Yes 101 FILE_gc_PCAPITALLETTERS Restriction on capital letters for directory and file names 0: No 1: Yes Path specification 200 FILE_gc_PABSOLUTEPATH Restriction on absolute path specification 0: No 1: Yes 201 FILE_gc_PDRIVELETTER Support of drive letters 0: No 1: Yes 210 FILE_gc_PRESOLVER Support of Resolver Syntax for file names 0: No 1: Yes 211 FILE_gc_PFTPRESOLVER Support of FTP-Client functions 0: No 1: Yes 212 FILE_gc_PHTTPRESOLVER Support of http-Client functions 0: No 1: Yes Network 300 FILE_gc_PNETWORKDRIVES Support of network drives 0: No 1: Yes InOut: Scope Name Type Comment Return GetProperty DWORD Return value describes the property, see table. Input wProperty WORD Number of the property, see table.