I'm a bit stumpted on this one. First off, I'm writing this to be ported to C, so I'm using char and NOT using string stuff.
Here is the problem. The code compiles but doesn't run correctly. At the if pch = line, I see that both pch and stringtofind are defined as char * fields. However, when both contain the phrase "get" the code doesn't fall into the if code but jumps down to the else if line.
Why, if two fields are defined as char * and both have the same value ("get") , aren't they evaulated as the same? My only thought it that it has something to do with pointers.
const char * get_domain(char * cBuffer, char * strtofind)
//pull the URL from the header packet
//where header is build like
//...get /stuff/index.html ...
int flag = 0;
char * pch;
//break packet out by spaces as a delimiter
pch = strtok (cBuffer," ");
while (pch != NULL)
//review each bucket and look for the phrase "get"
if (pch == strtofind)
//indicates get is found
//flag to grab the next bucket of data which will contain the page location
//which could be something like /stuff/index.html
flag = 1;
else if (flag == 1)
pch = strtok (NULL, " ");