STcatMax


Routine

int STcatMax (const char Si[], char So[], int Maxchar)

Purpose

Concatenate at most N characters to a string

Description

This routine appends characters from the input string to the end of the second string. Characters are appended until a null is seen in the input string or the number of characters in the second string is Maxchar. Then a trailing null character is appended to the output string. If not all characters from the input string can be copied into the output string, a string truncated warning message is printed.

Parameters

<- int STcatMax
Number of characters in the output string
-> const char Si[]
Input character string to be appended to So
<-> char So[]
Output character string. This string is always null terminated, with at most Maxchar characters not including the terminating null character. If the sum of the input string lengths is more than Maxchar, only the first Maxchar characters appear in So and a warning message is printed.
-> int Maxchar
Maximum number of characters (not including the trailing null character) to be placed in So. Note that So may be longer than Maxchar if it is so before calling this routine.

Author / revision

P. Kabal Copyright (C) 1995 / Revision 1.16 1995/05/12

See Also

STcopyMax, STcopyNMax


Main Index libtsp