Skip to content

Instantly share code, notes, and snippets.

@alsamitech
Last active March 4, 2021 05:59
Show Gist options
  • Select an option

  • Save alsamitech/ba611a4b4befb8ba4dae14abcc07548c to your computer and use it in GitHub Desktop.

Select an option

Save alsamitech/ba611a4b4befb8ba4dae14abcc07548c to your computer and use it in GitHub Desktop.
Compound Tokenizer
char** atokl(char* InC, char* delim, long unsigned int* len){
char** tok=(char**)malloc(2*sizeof(char*));
//printf("%p\n", tok);
tok[0]=strtok(strdup(InC), delim);
{
int i=1;
while(tok[i-1]!=NULL){
tok=(char**)realloc(tok, (i+1)*sizeof(char*));
tok[i]=strtok(NULL, delim);
//printf("%p\n", tok[i]);
i++;
}
*len=i;
/*EBRACE*/}
return tok;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment