0 Members and 1 Guest are viewing this topic.
struct split *stringSplit (char *str, char *delim){ char **token_array; *token_array = NULL; allocPtrs (token_array); char *token = str, *saveptr; unsigned int bulk = 1, j; for (j=0; ; token=NULL) { token = strtok_r (token, delim, &saveptr); if (token) { if (j == bulk*CHAR_PTRS) { allocPtrs (token_array); bulk++; } *token_array+j = calloc (1, strlen (token)+1); if (! *token_array+j ) error ("calloc"); strcpy (*token_array+j, token); j++; } else break; } struct split *s_arr = calloc (sizeof(struct split), 1); s_arr->num = j; s_arr->token_array = token_array; return s_arr;}
stringlib.c: In function ‘stringSplit’:stringlib.c:50:28: error: lvalue required as left operand of assignment *token_array+j = calloc (1, strlen (token)+1); ^