SysFileOpen

This function of type DWORD serves to open a file, which already exists or which should be created.

The return value is a file number, which will be used in the functions SysFileWrite, SysFileRead, SysFileClose as an input (‘File’). In case of an error ‘0’ will be returned resp. (watch out this exception!) ‘-1’ by target CoDeSys SP RTE.

Input-Variable Data Type Description
FileName STRING File name
Mode STRING

Access mode:

  • w write (File will be updated or created newly)
  • r read (File will only be opened for reading; if the file does not  exist, an error will be returned)
  • rw read and write (File will be updated; if the file does not  exist, an error will be returned)
  • a append (File will be opened like described for ‘w’, but the  written data will be appended at the end of the file)