View Single Post
  #1 (permalink)  
Old 10-23-2007, 12:24 PM
Salrandin Salrandin is offline
Newbie
 
Join Date: Oct 2007
Posts: 10
Rep Power: 0
Salrandin is on a distinguished road
Send a message via AIM to Salrandin
Default I dont understand this parser code

C Code:
  1. void my_split(const char* tosplit, const char* delim, char** parsed, int* len)
  2. {
  3.     char *local = strdup(tosplit);
  4.     char *tok = strtok(local, delim);
  5.     int i = 0;
  6.     while(tok) {
  7.         *parsed++ = strdup(tok);
  8.         i++;
  9.         tok = strtok(NULL, delim);
  10.     }
  11.     *len = i;
  12.     free(local);
  13. }

Can anyone explain this to me? i know it parses with a delimeter
but im not quite sure how it works
Reply With Quote

Sponsored Links