Null-Terminated Strings

The AFTP API does not require input strings to be null-terminated and does not guarantee that output strings are null-terminated. If there is a null terminator, it is not included in the return size.

The C programmer should be aware of the fact that strings are handled differently in AFTP than they are in the C standard library. All API calls receiving strings as input require both the string itself and the length of the string. The strlen function can be used for this. The null terminator must not be counted as part of the string length. API calls that output strings require three string-related parameters:

  • The string.
  • The length of the string buffer that has been allocated by the calling program.
  • The actual length of the string that is output. AFTP output strings are not null-terminated. For the C programmer to use them as standard C strings, a null character must be added to the end of the string.