chrAppnd

Copy one string into another, ignoring trailing blanks

Description:

The string "str1" (or as much of it as there is room for) is copied into the part of "str2" beginning at position "iposn". "iposn" is updated to indicate the final length of "str2" after this operation. Trailing blanks in "str1" are ignored.

Invocation

void chrAppnd( const char str1, char str2, size_t str2_length, size_t iposn )

Notes:

If the output string is too small to append the entire input string, truncation will occur and "iposn" will be set to the total length of "str2" (excluding the trailing null).

Parameters :

str1
Pointer to a null terminated string holding the string to be copied.
str2
Pointer to a null terminated string holding the string to be updated.
str2_length
The maximum length of the str2 string. This should include room for the terminating null.
iposn
The used length of the "str2". If "str2" is empty on entry, then this should be supplied as zero. On exit, the supplied value is incremented by the length of "str1" (ignoring any trailing spaces).