|
-
Nov 10th, 2001, 06:07 PM
#1
Thread Starter
Hyperactive Member
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,
-
Nov 10th, 2001, 10:31 PM
#2
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';
}
-
Nov 11th, 2001, 12:19 AM
#3
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|