SysFileWrite

This function of type DWORD serves to write data to a file, which has been opened before by the function SysFileOpen. The return value is the number of successfully written bytes.

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
File DWORD File number (see SysFileOpen)
Buffer DWORD Address of the buffer (ascertainable by the ADR operator) of the file to which you want to write
Size DWORD Number of bytes, which you want to write to the file (ascertainable by the SIZEOF operator )

Example:\ \

WriteBuffer : ARRAY[0..5] OF BYTE:=0,1,2,4,5,6;

DwWritten : DWORD;

hFile : DWORD;

../_images/8269edcc39390d130a317f346af09e9c