lundi 23 février 2015

Convert a char * [] to a string in C

How can I convert an array of character pointers (ie. an array of strings) into a single string in C?


For example:



char * args[MAXLINE/2+1];
char s[MAXLINE] = args; //<-- Pseudo code: How is this accomplished?


It must involve taking each string from each indice in args and concatenating them together to get the final string. But when I tried doing this, I couldn't get strcat to work with a char* array.


Aucun commentaire:

Enregistrer un commentaire