J
jobo
Hey,
I'm trying to detect the EOF of the file I pass to my scanf function.
Does anyone know why my if statement isn't triggering? 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("END!");
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 of the file I pass to my scanf function.
Does anyone know why my if statement isn't triggering? 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("END!");
printf("%d", count);
return 0;
}
test = x;
if (test >= 48 && test <= 57) {
test = test - 48;
temparr[count]= test;
count++;
}
}