Date: Fri, 29 Mar 1996 14:52:53 -0800 From: pierre AT dahlgren-19 DOT Eng DOT Sun DOT COM (Pierre Willard / Thomson Sun Interactive) Message-Id: <9603292252.AA02443@phi2.Eng.Sun.COM> To: djgpp AT delorie DOT com Subject: bug sscanf when match fails ? Reply-To: pierre AT Eng DOT Sun DOT COM It seems that sscanf does not stop parsing when a match fails (as it should). The following shows the bug. This has been tested on v1, but someone told me it was the same with v2. Regards Pierre Willard #include main() { char *test_str = "demo PPL_ID 10"; char app_name[40], expstr[20]; int match; int app_id; app_name[0]=0; expstr[0]=0; match = sscanf(test_str, "%s %d %s", app_name, &app_id, expstr); printf("match = %d, app_name = \"%s\", app_id = %d, expstr = \"%s\"\n", match, app_name, app_id, expstr); } /* Result on Solaris (correct): ============================ match = 1, app_name = "demo", app_id = 0, expstr = "" Result on DJGPP (incorrect) ======================== match = 2, app_name = "demo", app_id = 0, expstr = "PPL_ID" */