I would guess that sscanf function more often used to pick the specific parts of the string rather than check for any string pattern existence. Like for example the following code
Code:
#include <stdio.h>
int main(void)
{
const char linestr[] = "HTTP/1.0 200 OK ";
const char *ptr = linestr;
char buffer[25];
if( sscanf( ptr, "%*[^ ] %[^\n]", buffer ) )
printf("Found!! -- > %s", buffer);
else
printf("Not found\n");
getchar();
return 0;
}
/* myn output
Found!! -- > 200 OK
*/
This can pick the string "200 OK" from the input string but then you will have to put some extra effort to see if you have got the right string. I might be wrong. If you want to check for like specific patterns then you might have to use some regular expression to achieve that. Or as suggested before use strstr function to find the string.
-ssharish