I am talking about some sort of function that can combine an array of character arrays into a single string.
Would I just have to loop through the array of strings and do it manually? The string was created using strtok().
I am talking about some sort of function that can combine an array of character arrays into a single string.
Would I just have to loop through the array of strings and do it manually? The string was created using strtok().
If you have an array of char arrays, like this:
char foo[<num>][<len>];
...then you can convert it into a string like this:
char *bar = (char *)foo;
If your strings are NULL-terminated or smaller than len, you may have to memmove() foo[i+1] to the position of strlen(bar) for each i.
Of course, it might be easier to just iterate through the array and concatenate the strings using strcat().