You can use an extra variable to read anything past the last
character then if you don't a return code of 4 there was an error.
I think thats the simplest way to do it.
PHP Code:
#include <stdio.h>
#include <string.h>
main(argc,argv)
int argc;
char *argv[];
{
int num, num2;
char matchme[]="1,5,\"some text\",h\n";
char str[40];
char ch[3], endchars[100];
if (sscanf(matchme, "%d,%d,%[^,],%1[hv]%[^\n]", &num,
&num2, str, ch, endchars ) != 4)
printf("Error reading string 1.\n");
else
printf("%d %d %s %s\n", num, num2, str, ch);
}/*main */