Bonjour,
Pour mon examen, j'ai un exercice préparatoire mais je suis un peu perdu...
L'énoncé est le suivant:

j'ai codé le début mais la je suis totalement perdu...
debut:
#include <stdio.h>
#include <stdlib.h>
struct Participant
{
char NomJoueur[30]; //Enregistrement des fichiers
char sexe;
char Nationalite[30];
int NumRang;
char Resultat[12];
};
struct Index
{
char NomJoueur[30]; //Enregistrement LLU(triée sur NUMRANG)
char sexe;
int NumRang;
int GP;
long posi;
struct Index *next;
};
void Affiche_Participants(char *nom_F1);
int main()
{
int nbparticipant ;
struct Participant participant; //Variable de travail de type struct participant
struct Index *index=NULL; //Variable de travail de type struct ind
FILE *fp1=NULL;
FILE *fp2=NULL;
FILE *fp3=NULL;
FILE *fp4=NULL;
char nom_F1 []="Roland_Garros.dat";
char nom_F2 []="RG_Homme.dat";
char nom_F3 []="RG_Femme.dat" ;
char nom_F4 []="PODIUM.dat";
Affiche_Participants(nom_F1);
return 0;
}
void Affiche_Participants(char *nom_F1)
{
FILE *fp1 = NULL;
struct Participant participant;
int i = 1;
printf("\nAffichage des participants\n");
printf("-----------------------------\n\n");
printf("Num Joueur Nom Sexe Nationalite NumRencontre Resultat \n");
printf("---------------------------------------------------------------------------\n");
fp1 = fopen(nom_F1,"rb");
if(!fp1)
printf("\nFichier non existant, ou probleme d'ouverture !\n");
else
{
//fseek(fp1,0,SEEK_SET); //pas oblige car l'ouverture nous met debut du fichier
fread(&participant,sizeof(struct Participant),1,fp1);
while(!feof(fp1))
{
printf("Joueur %-5d",i);
printf("%-15s",participant.NomJoueur);
printf("%-5c",participant.sexe);
printf("%-18s",participant.Nationalite);
printf("%-13d",participant.NumRang);
printf("%s",participant.Resultat);
printf("\n");
i++;
fread(&participant,sizeof(struct Participant),1,fp1);
}
}
fclose(fp1);
}
PS: Je ne demande en aucun cas qu'on me fasse l'exercice, je suis juste totalement bloqué et ne vois pas ou je dois aller, ce que je dois faire... Juste une aide pour m'avancer ou/et me debloquer...
D'avance merci !