I have a problem.
I wrote:
for(i=0; i<n; i++)
{
m++;
char **exP = realloc(exParam, m*sizeof(*exParam));
char **exT = realloc(exText, m*sizeof(*exText));
exParam = exP;
exText = exT;
explode = strtok(lines[i], "#");
while(explode != NULL)
{
exParam[m-1] = malloc(strlen(explode+1));
strcpy(exParam[m-1], lines[i]);
exText[m-1] = malloc(strlen(explode+1));
strcpy(exText[m-1], explode);
explode = strtok(NULL, "#");
//printf("> %s\n", explode);
//printf("> %s\n", exParam[m-1]);
//printf("> %s\n", exText[m-1]);
}
}
And I want to obtain two arrays. My first array (lines) looks like SOMETHING#Some text. How to explode this text to two arrays exParam with data before # and exText with string after #? What's wrong in my method?