Working on parse function in Pset6. I have started by creating some pointers to known characters in the request-line:
bool parse(const char* line, char* abs_path, char* query)
{
const char* sp1 = strchr(line, " ");
const char* sp2 = strrchr(line, " ");
const char* sl1 = strchr(line, "/");
const char* quer = strchr(line, "?");
My question is, how do I read the portions of the request-line between these pointers? For instance, I want to check if method is GET. Does a pointer already exist to the beginning of const char* line? If so, is there a way to read from the beginning of line and stop at sp1 so that I can check if it is = to GET? Likewise, the same goes for reading between sl1 and sp2. I have read the man pages for strstr, strcpy, and memcpy and am not sure how to use them unless I can first read between the pointers. Any help understanding reading and manipulating strings or a good reference explanation would be great. So far, my internet searches have not been very fruitful. Most guides only tell how to access/read/copy a known sub-string between 2 pointers.