APL/Révisions/Fichiers/records.c

19 lines
438 B
C
Raw Permalink Normal View History

2022-01-25 12:00:33 +01:00
#include <stdio.h>
#include <stdlib.h>
int main(void) {
FILE* f = fopen("top10", "r");
if (f) {
for (int i = 0; i < 10; i++) {
if (!feof(f)) {
int score;
char nom[4];
fread(&score, sizeof(int), 1, f);
fread(nom, sizeof(char), 3, f);
printf("%09d %s\n", score, nom);
} else break;
}
fclose(f);
}
}