You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.4 KiB
68 lines
1.4 KiB
#include "partie1.h"
|
|
|
|
|
|
ListeDept listenouv(void)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
ListeDept insererEnTete(ListeDept l, char departement[], int nbP)
|
|
{
|
|
MaillonDept *m;
|
|
m = (MaillonDept *)malloc(sizeof(MaillonDept));
|
|
if (m == NULL)
|
|
{
|
|
printf("Fonction insererEnTete : problème malloc");
|
|
exit(1);
|
|
}
|
|
strcpy(m->departement, departement);
|
|
m->nbP = nbP;
|
|
m->suiv = l;
|
|
return l;
|
|
}
|
|
|
|
ListeDept chargeListeDept(VilleIUT *tiut[])
|
|
{
|
|
int i = 0;
|
|
ListeDept liste = listenouv();
|
|
FILE *file = fopen("informationsIUT.don", "r");
|
|
while (!feof(file))
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
int chargementVilleIUT(VilleIUT *tiut[])
|
|
{
|
|
FILE *file = fopen("informationsIUT.don", "r");
|
|
VilleIUT villeiut;
|
|
char ville[30], dept[30], nomResp[30];
|
|
int nbP, i = 0;
|
|
if (file == NULL)
|
|
{
|
|
printf("Fonction chargementVilleIUT : Problème lors de l'ouverture du fichier informations.don");
|
|
exit(-1);
|
|
}
|
|
while (!feof(file))
|
|
{
|
|
tiut[i] = (VilleIUT *)malloc(sizeof(VilleIUT));
|
|
if (tiut[i] == NULL)
|
|
{
|
|
printf("erreur malloc");
|
|
exit(-1);
|
|
}
|
|
fscanf(file, "%s%s%d", tiut[i]->ville, dept, &nbP);
|
|
fgets(nomResp, 30, file);
|
|
i++;
|
|
}
|
|
fclose(file);
|
|
return i;
|
|
}
|
|
|
|
void affichage(VilleIUT *tiut[], int nb)
|
|
{
|
|
for (int i = 0; i < nb; i++)
|
|
{
|
|
printf("%s\n", tiut[i]->ville);
|
|
}
|
|
} |