Hi
strcpy is standard C function, so it is available everywhere. Using strcpy and strcat works fine, but you have to be sure the strings you're joining are terminated with NULL '\0', otherwise your app can crash.
A safer option is the "n" variation of them: strncpy and strncat. The only difference from what baxslash told you is that you have to tell the number of characters of each string. So, using the same example:
+ Code Snippet#include <iostream.h>
#include <string.h>
void main()
{
char testString[20];
char testString2[10];
strncpy(testString2,"World" , 5);
strncpy(testString1,"Hello ", 4); // Copies first string
strcat(testString1, testString2, 5); // Concatinates the second string
}
If you want to code on different platforms this is probably the best bet. C++ in other hand, can provide you String classes that makes this job easier. I believe Cocoa has NSString, but it is only used on Apple platforms (iOS and MacOS).
Cheers