I know how to use strcpy() but I can't figure out how to take multiple string and merge them into 1.
Printable View
I know how to use strcpy() but I can't figure out how to take multiple string and merge them into 1.
Do you mean like strcat()?
It concatenates one string onto the end of another.
used like this:Code:#include <stdio.h>
#include <string.h>
int main ()
{
char str[80];
strcpy (str,"d0");
strcat (str,"0b");
puts (str);
return 0;
}
Very good of you d00b to give an example but I was kinda hoping my post would prompt them to research strcat() themself. Best way to learn I think.
:rolleyes:
IF you have STL then it's a simple call to the overloaded + or += operators in the string class. If you're like me, you're stuck with strcat(). Darn.