Cooler_

parse get

Aug 5th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.  char *url="http://teste.com.br/index.php?var=2&ball=7&search=lol";
  7.  char *ptr=url;
  8.  char *parse=(char *)malloc(sizeof(char)*4098);
  9.  int counter=0,x=0,jmp=0;
  10.  
  11.  while(*ptr != '\0' && !jmp)
  12.  {
  13.   if(*ptr == '?')
  14.   {
  15.    ptr++;
  16.    while( *ptr != '\0' && x < 4098-1)
  17.    {
  18.     *(parse+x)=*ptr;
  19.     x++;
  20.     ptr++;
  21.    }
  22.    jmp=1;
  23.   }
  24.   ptr++;
  25.  }
  26.  free(parse);
  27.  
  28.  fprintf(stdout,"%s\n",parse);
  29.  
  30.  return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment