Для одиночного разделителя
char *unsplit(char *buff, char **argv, size_t size, int delimiter)
{
size_t pos = 0;
for (size_t index; index < size; index++)
{
strcpy(buff + pos, argv[index]);
pos += strlen(argv[index]);
if(index != size - 1)
{
buff[pos++] = delimiter;
buff[pos] = 0;
}
}
return buff;
}
char *unsplitNULL(char *buff, char **argv, int delimiter)
{
size_t pos = 0;
while(*argv)
{
strcpy(buff + pos, *argv);
pos += strlen(*argv++);
if(*argv)
{
buff[pos++] = delimiter;
buff[pos] = 0;
}
}
return buff;
}
int main()
{
char *str[] = {"3443", "erte", "sdfdsffd", "wewere", NULL};
char buff[100];
printf("%s\n", unsplit(buff, str, 4, ','));
printf("%s\n", unsplitNULL(buff, str, ','));
return 0;
}