Results 1 to 3 of 3

Thread: Split a querystring into smaller parts

  1. #1

    Thread Starter
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394

    Unhappy Split a querystring into smaller parts

    Hello ,

    I have started writing an ISAPI extension and i am stuck with querystring. The querystring get returned as a whole string, not split up.

    I need to split querystring into params and values, like it is done in PERL. I dont know how to split a string by a & sign.

    This is all i've got so far:

    PHP Code:
       char qStr[5];
       
    int qLen;    

       
    //Get the query string part
       
    strcpy(qStr,pECB->lpszQueryString);
       
       
    //Attempt to convert string to a number (for later use)
       
    qLen atoi(qStr); 

    Is there an alternative to split() function in C++, like in Visual Basic?

    Thanks for your help,
    VS.NET 2003

    Need to email me?

  2. #2
    jim mcnamara
    Guest
    THere is no standard C version of split.

    C split()

    Code:
    void split(char **dest, char *string, int elements, char sep){
                  char *buf;
                  char *s;
                  int i;
                  elements = 0;
                  buf = string;
                  s = dest[elements];
                  for (i=0<;i<strlen(string);i++){
                           if (*buf = sep){ 
                                  s++;        
                                  *s = '\0';
                                  elements++;
                                  s = dest[elements];
                           }
                           else {
                                  *s++ = *buf++;
                  }
                   s++;
                   *s='\0';
    }

  3. #3

    Thread Starter
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394

    Wink

    Thanks a lot.
    VS.NET 2003

    Need to email me?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width