C Style
- Last UpdatedSep 05, 2024
- 1 minute read
If a string is read using the C Style, the string always uses all of the registers allocated. The PLC string is stored in the server string as is, except that the last character contained in the last register of the string is replaced with a null character (hex 00).
If a string is written and the string is shorter than the allocation of registers, it is padded with ASCII null characters (hex 00).
For example:
If the string "Communications" is stored in the string item "400001-400010 m," registers
400001 through 400005 contain the string "Communications" and registers 400006 through
400010 contain nulls.
If the string "Communications" is stored in the string item "400001-400005 m," registers
400001 through 400005 contain the truncated string "Wonderwar0" with a null character
replacing the last character "e."
A message is placed in the logger indicating that the string was truncated.