setNullTerminator()

The strLib.setNullTerminator() system function changes all trailing spaces in a string to null values.

Use strLib.setNullTerminator() to convert a variable before passing it to a C or C++ program that expects a null-terminated string as an argument.

Syntax

  strLib.setNullTerminator(target CHAR | DBCHAR | MBCHAR | UNICODE inOut)
target
The target can be any of the text types shown.

Example

  target CHAR(25) = "Freddy Ramirez";

  strLib.setNullTerminator(target);
  // target is now "Freddy Ramirez" followed by 6 nulls

Error conditions

If you use V6 exception compatibility mode (see Using V6 exception compatibility), the following error code might be returned in sysVar.errorCode:
00000016
Last byte of string is not a space or a null value

Feedback