string concatenation
-
i want to know how to concatenate two string (Eg: str1 & str2)
-
i want to know how to concatenate two string (Eg: str1 & str2)
-
i want to know how to concatenate two string (Eg: str1 & str2)
Which kind of string ? C style strings ? Then use strcat. std::string ? Then use the + operator.
Cédric Moonen Software developer
Charting control [v1.5] OpenGL game tutorial in C++ -
i want to know how to concatenate two string (Eg: str1 & str2)
Use
std::string
orCString
and then you can do it like this:std::string a = "Hello ";
std::string b = "World";std::string c = a + b;
or
CString a = "Hello ";
CString b = "World";CString c = a + b;
Otherwise, if you just use C strings, you have to do stuff like this:
char a[10];
char b[10];
char c[20];
strcpy(a, "Hello ");
strcpy(b, "World");
strcpy(c, b);
strcat(c, a);Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p