J
jobo
Hello,
I'm trying to detect the EOF for scanf. But for some reason I can't get
it to trigger. What am I doing wrong? Thanks.
int puzzle[9][9]; // Puzzle data structure
int i, j, count; // Iteration variables
int temparr[81];
char x;
int test;
count = 0;
while (count < 82){
scanf("%c", &x);
if (x == EOF) {
printf("****!");
printf("%d", count);
return 0;
}
test = x;
if (test >= 48 && test <= 57) {
test = test - 48;
temparr[count]= test;
count++;
}
}
I'm trying to detect the EOF for scanf. But for some reason I can't get
it to trigger. What am I doing wrong? Thanks.
int puzzle[9][9]; // Puzzle data structure
int i, j, count; // Iteration variables
int temparr[81];
char x;
int test;
count = 0;
while (count < 82){
scanf("%c", &x);
if (x == EOF) {
printf("****!");
printf("%d", count);
return 0;
}
test = x;
if (test >= 48 && test <= 57) {
test = test - 48;
temparr[count]= test;
count++;
}
}