Im having some trouble parsing http headers.
Here is my problem:
char resp[] = "HTTP/1.1 200 OK\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 4\r\n"
"\r\n"
"text";
// some stuff
sscanf(resp, "HTTP/%f %d\r\n",&version,&code);
sscanf(resp, "%*[^]Content-Length: %d",&size);
// ^ tried several things here
I thought using sscanf would be a good idea,since i only want to get a few values (if they exist).
My idea was to skip all the headers i dont want.
My questions are:
1-is sscanf a good idea?
2-if not what what approach would work better
Thank you.