1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#include <stdio.h>
enum
{
ok, erreur,
max_etudiants = 10,
taille_chaine = 32,
nb_cours_offerts = 16,
max_cours = 32,
dummy
};
static char const nomFichier[] = "data.txt";
void chargementDonnees (int matricules[max_etudiants],
char noms[max_etudiants][taille_chaine + 1],
char prenoms[max_etudiants][taille_chaine + 1],
char nomsCours[nb_cours_offerts][taille_chaine + 1],
char *cours[max_etudiants][max_cours],
float notes[max_etudiants][max_cours],
int nbCours[max_etudiants], int *code_err)
{
int i = 0;
FILE *fichier = fopen (nomFichier, "rt");
*code_err = erreur;
if (fichier == NULL)
{
printf ("Erreur d'ouverture de Fichier\n");
exit (1);
}
/*** j essayer ici avec fscanf s a pas marche****/
*code_err = ok;
}
int main (void)
{
int matricules[max_etudiants];
char noms[max_etudiants][taille_chaine + 1];
char prenoms[max_etudiants][taille_chaine + 1];
char *cours[max_etudiants][max_cours]; //le tableau de pointeurs dun étudiant, chaque pointeur pointant sur le nom du cours auquel létudiant est inscrit
float notes[max_etudiants][max_cours];
int nbCours[max_etudiants]; //le nombre de cours auquel chaque étudiant est inscrit
char nomsCours[nb_cours_offerts][taille_chaine + 1];
int code_err;
chargementDonnees (matricules, noms, prenoms, nomsCours, cours, notes,
nbCours, &code_err);
return 0;
} |
Partager