Having trouble getting GET variables from url.

Posted by mchl on Stack Overflow See other posts from Stack Overflow or by mchl
Published on 2011-01-08T22:54:39Z Indexed on 2011/01/08 23:54 UTC
Read the original article Hit count: 147

Filed under:
|
|
|
|

Hey everyone,

I'm having trouble with this algorithm to extract the get variables from a url and print them each on a new line like:

x=y
z=hello

etc. but instead it prints a seemingly random section of the url with no newlines to the file. There must be a logic error of some kind but i just can't spot it.

for(i_m=0;i_m<len_m;i_m++) {

if(var_m[i_m]=='&') {
    fwrite(var_m+offset_m, 1, amp_m, echo_out);
    fputc('\n',echo_out);
    offset_m+=amp_m;
    amp_m=0;
}

amp_m++;
}

any help appreciated.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c