HELPLIB.HLB  —  CRTL  strcat
    Concatenates str_2, including the terminating null character, to
    the end of str_1.

    Format

      #include  <string.h>

      char *strcat  (char *str_1, const char *str_2);

1  –  Function Variants

    The strcat function has variants named _strcat32 and _strcat64
    for use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 str_1, str_2

    Pointers to null-terminated character strings.

3  –  Description

    See strncat.

4  –  Return Value

    x                  The address of the first argument, str_1,
                       which is assumed to be large enough to hold
                       the concatenated result.

5  –  Example

        #include <string.h>
        #include <stdio.h>

        /* This program concatenates two strings using the strcat       */
        /* function, and then manually compares the result of strcat    */
        /* to the expected result.                                      */

        #define S1LENGTH 10
        #define S2LENGTH 8

        main()
        {
            static char s1buf[S1LENGTH + S2LENGTH] = "abcmnexyz";
            static char s2buf[] = " orthis";
            static char test1[] = "abcmnexyz orthis";

            int i;
            char *status;

            /* Take static buffer s1buf, concatenate static buffer      */
            /* s2buf to it, and compare the answer in s1buf with the    */
            /* static answer in test1.                                  */

            status = strcat(s1buf, s2buf);
            for (i = 0; i <= S1LENGTH + S2LENGTH - 2; i++) {
                /* Check for correct returned string.   */

                if (test1[i] != s1buf[i])
                    printf("error in strcat");
            }
        }
Close Help