If you have integers in your file fscanf returns 1 until integer occurs. For example:
FILE *in = fopen("./task.in", "r");
int length = 0;
int counter;
int sequence;
for ( int i = 0; i < 10; i++ ) {
counter = fscanf(in, "%d", &sequence);
if ( counter == 1 ) {
length += 1;
}
}
To find out the end of the file with symbols you can use EOF. For example:
char symbol;
FILE *in = fopen("./task.in", "r");
for ( ; fscanf(in, "%c", &symbol) != EOF; ) {
printf("%c", symbol);
}