#include <string.h> char *strcat(char *to, const char *from);
strcat
adds characters from the second argument string from
to
the end of the first argument string to
until a terminating-null
character is found. The null also is copied.
to
string.
to
string for all the characters of the combined string. Characters are
copied until a null character is found in the source string, or until a
protection or addressing exception occurs. A program check also can
occur if the to
string is not properly terminated. The effect of
strcat
is not defined if the to
and from
fields overlap.
#include <lcstring.h> #include <stdio.h> #define MAXLINE 100 main() { char line[MAXLINE+1]; char message[MAXLINE+11]; puts("Enter a line of text to be translated to lowercase letters:"); gets(line); strcat(strcpy(message, "INPUT: "), line); puts(message); /* Label and echo the input. */ strlwr(line); /* Turn the input into lowercase letters. */ strcat(strcpy(message, "OUTPUT: "), line); puts(message); /* Label and print the results. */ }
strcpy
, strncat
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.