This topic is now archived and is closed to further replies.


how to copy 2 char arrays using a method?

Recommended Posts

Original post by johnnyBravo
Hi, are there any methods to copy [two] char arrays together

What do you mean by "together"? strcpy replaces one char array with a null terminated string from the other. strcat takes one string and copies it to the null terminating location of the other string. (ie buf1 = "foo" buf2 = "bar" then strcat(buf1, buf2) = "foobar"). If the char array isn''t a string then you''ll want to just use memcpy(buf1, buf2, 256) to copy the entirety of one array to the other.

Erzengel des Lichtes
Archangel of Light

Share this post

Link to post
Share on other sites