char* strncat(char* cpDest, const char* kcpSrc, size_t qCount);
#include <cstdio>
#include <cstring>
int main()
{
char caSource[] = ".net";
// Allocate enough room for concatenation
char caDest[10] = "XoaX";
// The two strings before concatenation
printf("%s and %s before\n", caDest, caSource);
// Only append two chars
strncat(caDest, caSource, 2);
// The destination string after concatenation
printf("%s after\n", caDest);
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.