I'm trying to use scansets to filter out out some textfiles.
#include <stdio.h>
int main( void)
{
int i;
char str[ 80], str2[ 80];
scanf("%d %[abcdefg] %s", &i, str, str2);
printf("%d %s %s", i, str, str2);
getchar();
return 0;
}
When I input "123abcdtye" I expect the output to be "123 abcd tye". Instead my program exits as if it reaches the return statement even though I have put in a getchar() to pause the program. What is going on?