2017-10-21 23:40:19 +00:00
|
|
|
/* Conformance Test 17.8.0.13: Verification of sscanf, c format code */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
int main (void)
|
2017-10-21 23:40:19 +00:00
|
|
|
{
|
|
|
|
char sstr [] = "bten chars!andMore";
|
|
|
|
int i;
|
|
|
|
char ch, string [50];
|
|
|
|
|
|
|
|
|
|
|
|
ch = 'a'; /* no assignment should be made */
|
2022-10-17 22:50:42 +00:00
|
|
|
i = sscanf (sstr, "%*c");
|
2017-10-21 23:40:19 +00:00
|
|
|
if (i != 0)
|
|
|
|
goto Fail;
|
|
|
|
if (ch != 'a')
|
|
|
|
goto Fail;
|
|
|
|
|
2022-10-17 22:50:42 +00:00
|
|
|
i = sscanf (&sstr [1], "%10c", string); /* test assignment to string*/
|
|
|
|
if (i != 1)
|
2017-10-21 23:40:19 +00:00
|
|
|
goto Fail;
|
|
|
|
if (strncmp (string, "ten chars!", 10))
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
printf ("Passed Conformance Test 17.8.0.13\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
printf ("Failed Conformance Test 17.8.0.13\n");
|
2022-10-17 22:50:42 +00:00
|
|
|
return 0;
|
2017-10-21 23:40:19 +00:00
|
|
|
}
|