I have to input a .in file into my program.gcc ./"file" < file.in
Because there are more than one input I have to use the While loop EOF, but
because of that I can't scanf again.
Here's a mock version of my program. Thank you
#include <stdio.h>
int main() {
int arr[100];
int num;
int count = 0;
while( scanf("%d", &arr[count]) != EOF ) {
count++;
}
printf("%d\n", arr[0]);
scanf("%d", &num);
printf("%d\n", num);
}
intvalues. So it will be either 1 on success or 0 on failure. Or it can be EOF if a reading error or end-of-file happens. See cplusplus.com/reference/cstdio/scanf - CiaPanstdinand then wants to to continue reading from the console (non-re-directed input). It is not so much of what the program sample produces as much as how it can consume input from re-directedstdinand then "not-re-directed"stdin. - chux - Reinstate Monica