DEV_BUT1/DEV1.1S/TP03/records.c

27 lines
511 B
C
Raw Normal View History

2023-02-08 11:18:16 +01:00
#include <stdio.h>
#include <stdlib.h>
int main(void){
FILE* fichier;
fichier = fopen("top10", "r");
int tab[10];
char oui[30];
int i;
int a;
int alt = 4;
for(i=0; i<10; i++){
fread(&tab[i], sizeof(int), 1,fichier);
fread(&oui[i*3], 1, 3, fichier);
}
for(i=0; i<10;i++){
printf("%9d ", tab[i]);
printf("%c", oui[i*3]);
printf("%c", oui[i*3+1]);
printf("%c\n", oui[i*3+2]);
}
fclose(fichier);
return EXIT_SUCCESS;
}
/*[004867123,41545574]
[B,O,B,<,O,>]
004867123 BOB
41545574 <O>*/