Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1.  49 struct lines * getLines(struct lines * arg1, char * input, char * seperator)
  2.  50 {
  3.  51   char * inputCopy = malloc(strlen(input));
  4.  52   memcpy(inputCopy, input, strlen(input));
  5.  53   char * line;
  6.  54   line = strtok(input,seperator);
  7.  55   int l =0;
  8.  56   while (line != NULL)
  9.  57     {
  10.  58     sprintf(arg1[l].line, line);
  11.  59     if (DEBUG)
  12.  60     printf("%s\n",arg1[l].line);
  13.  61     line = strtok(NULL, seperator);
  14.  62     l++;
  15.  63     }
  16.  64   arg1->linecount = l;
  17.  65   free(line);
  18.  66  
  19.  67   memmove(input, inputCopy, strlen(inputCopy));
  20.  68   return arg1;
  21.  69 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement