diff --git a/src/DataBase/Etudiants.layout b/src/DataBase/Etudiants.layout new file mode 100644 index 0000000..3b7bb99 --- /dev/null +++ b/src/DataBase/Etudiants.layout @@ -0,0 +1,21 @@ +3 +Grenoble +Clermont-Ferrand +Limoges +Aurillac +1 +Informatique +112 +Dupont Jean +2 +Informatique +136 +Simon Carine +Biologie +120 +Dupond Jean +0 +1 +Bio-Informatique +56 +Duponlt Jeanne \ No newline at end of file diff --git a/src/annexe/saeAnnexe.c b/src/annexe/saeAnnexe.c index 0c180b0..b718b8d 100644 --- a/src/annexe/saeAnnexe.c +++ b/src/annexe/saeAnnexe.c @@ -2,6 +2,7 @@ #include #include #include "saeAnnexe.h" +#include "../partie1/saeP1.h" void menu(void){ printf("#--------------------------------------------------------------------#\n"); @@ -16,11 +17,47 @@ void menu(void){ printf("Choisissez votre session : "); } -int loadIUT(char* tiut[]){ - break//A FAIRE ! +int loadIUT(VilleIUT** tiut){ + FILE* f=fopen("Etudiants.bin","rb"); + MaillonDep* m; + if(f==NULL){ + perror("fopen"); + exit(errno); + } + int tlogi; + fread(tlogi,sizeof(int),1,f); + for(int i=0; iVille,sizeof(char),31,f); + } + for(i=0; ildept=(MaillonDep*)malloc(sizeof(MaillonDep)); + if(tiut[i]->ldept==NULL){ + perror("malloc"); + exit(errno); + } + } + m=tiut[i]->ldept; + for(int j=0; jdepartement,sizeof(char),31,f); + fread(m->nbp,sizeof(int),1,f); + fread(m->resp,sizeof(char),51,f); + if(jsuivant=(MaillonDep*)malloc(sizeof(MaillonDep)); + if(m->suivant==NULL){ + perror("malloc"); + exit(errno); + } + m=m->suiv; + } + } + } + return tlogi; } -int rechercheTabStr(char* tab[],int lTab,char* mot){ +int rechercheTabStr(char* tab[],int lTab,char* mot){/////////////////////////////////////// N O N ///////////////////////////// if(!lTab){ fprintf(stderr,"Erreur, Pas d'éléments dans le tableau !"); return -1; diff --git a/src/annexe/saeAnnexe.h b/src/annexe/saeAnnexe.h index d1928a4..c1a1238 100644 --- a/src/annexe/saeAnnexe.h +++ b/src/annexe/saeAnnexe.h @@ -29,9 +29,9 @@ typedef struct file* File; // // // void menu(void); // // -int loadIUT(char* tiut[]); // +int loadIUT(VilleIUT** tiut); //Fichier Binaire. // // -int rechercheTabStr(char* tab[],int lTab,char* mot); // +int rechercheTabStr(char** tab[],int lTab,char* mot); ///////////////////////////////////// N O N //////////////////////////// // // // diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 36215bd..041bb51 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -148,7 +148,7 @@ void modifPlaces(VilleIUT* tiut,int tlogi){ char* ville[31]; scanf("%*c%s",&ville); if(ville=="Q") return; - int noVille=rechercheTabStr(tiut,tlogi,ville); + int noVille=rechercheTabStr(tiut,tlogi,ville);////////////////////////////// N O N /////////////////////////////////// if(noVille<=0){ fprintf(stderr,"Ville non existante !"); return; diff --git a/src/partie1/saeP1.h b/src/partie1/saeP1.h index 0e8d01b..270e4f8 100644 --- a/src/partie1/saeP1.h +++ b/src/partie1/saeP1.h @@ -28,9 +28,9 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi); //Admin -void menuAdmin(VilleIUT* tiut,int tlogi); +void menuAdmin(VilleIUT* tiut,int tlogi);///A CHANGER/// -void modifPlaces(VilleIUT* tiut,int tlogi); +void modifPlaces(VilleIUT* tiut,int tlogi);///A CHANGER/// //void creerDep(); diff --git a/src/saeMain.c b/src/saeMain.c index 1e326fd..3bf778e 100644 --- a/src/saeMain.c +++ b/src/saeMain.c @@ -9,7 +9,7 @@ int main(void) { - VilleIUT* tiut; + VilleIUT** tiut; int tlogi=loadIUT(tiut); menu(); char user;