commit
This commit is contained in:
parent
555dcd39b7
commit
c755619819
8 changed files with 83 additions and 10 deletions
|
@ -1,3 +1,10 @@
|
||||||
1,Rapport_du_GIEC,Jean_Jouzzel,15,11,2022
|
1,Rapport_du_GIEC,Jean_Jouzzel,15,11,2022
|
||||||
2,L_esprit_critique,Thomas_Durand,6,2,2023
|
2,L_esprit_critique,Thomas_Durand,6,2,2023
|
||||||
3,La_resilience,Arthur_Keller,20,10,2022
|
3,La_resilience,Arthur_Keller,20,10,2022
|
||||||
|
4,American_lobbying,Salah_Oueslati,30,11,2023
|
||||||
|
5,Crysper_case9_et_ADN,Peggy_Baron,18,10,2023
|
||||||
|
6,Materiaux_de_demain,Emmanuel_Chirache,15,11,2023
|
||||||
|
7,Les_IA,Matthieu_Maurer,1,6,2023
|
||||||
|
8,Therories_du_complots,Jean_Benoit,1,4,2021
|
||||||
|
9,Le_lacet_irlandais,Mick_Oconnell,31,3,2022
|
||||||
|
10,Litterature_et_SF,Terry_Pratchett,15,5,2021
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
2,Bertrand,42,5
|
1,Simon,21,3
|
||||||
|
2,Bertrand,42,8
|
||||||
3,Thomas,20,3
|
3,Thomas,20,3
|
||||||
4,Pasgrimaud_Victor,19,2
|
4,Victor,19,2
|
||||||
5,Leizour_Lukian,19,2
|
5,Lukian,19,2
|
||||||
|
6,Natacha,18,1
|
||||||
|
7,Caroline,22,4
|
||||||
|
8,Lucas,23,4
|
||||||
|
9,Clodine,64,3
|
||||||
|
10,Kevin,26,3
|
||||||
|
11,Titouan,18,1
|
||||||
|
12,Louise,20,3
|
||||||
|
13,Chayma,22,5
|
||||||
|
14,Elisa,23,5
|
||||||
|
15,Erwan,19,2
|
||||||
|
16,Juliette,32,8
|
||||||
|
17,Malick,25,7
|
||||||
|
18,Marion,17,1
|
||||||
|
19,Tom,17,1
|
||||||
|
20,Sebastien,45,5
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1:3,2,1,6,11,12,13,14,15,16
|
|
@ -59,6 +59,39 @@ void readListeners(ptListener listenerChain) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void readRelations(ptConf confChain, ptListener listenerChain) {
|
||||||
|
FILE *file = fopen("./data/relations", "r");
|
||||||
|
char line[100];
|
||||||
|
char *tokens[50];
|
||||||
|
char *token;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
if (file == NULL) {
|
||||||
|
printf("ça marche pas.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fgets(line, sizeof(line), file)) {
|
||||||
|
token = strtok(line, ":");
|
||||||
|
printf("%d\n", atoi(token));
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
while (token != NULL) {
|
||||||
|
tokens[i] = token;
|
||||||
|
i ++;
|
||||||
|
token = strtok(NULL, ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j = 1; j < i; j++) {
|
||||||
|
participateToConf(confChain, listenerChain, atoi(tokens[0]), atoi(tokens[j]));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
}
|
||||||
|
|
||||||
void saveConf(ptConf confChain) {
|
void saveConf(ptConf confChain) {
|
||||||
FILE *file = fopen("./data/confs", "w");
|
FILE *file = fopen("./data/confs", "w");
|
||||||
ptConf px = confChain;
|
ptConf px = confChain;
|
||||||
|
@ -81,9 +114,25 @@ void saveListeners(ptListener listenerChain) {
|
||||||
|
|
||||||
void saveRelations(ptConf confChain) {
|
void saveRelations(ptConf confChain) {
|
||||||
FILE *file = fopen("./data/relations", "w");
|
FILE *file = fopen("./data/relations", "w");
|
||||||
ptListener px = listenerChain;
|
ptConf px = confChain;
|
||||||
|
ptListenerList py;
|
||||||
while(px -> next != NULL){
|
while(px -> next != NULL){
|
||||||
fprintf(file,"%d,%s,%d,%d\n",px -> id,px -> name,px -> age,px -> level);
|
py = px -> listeners;
|
||||||
|
|
||||||
|
if (py -> next != NULL) {
|
||||||
|
fprintf(file, "%d:", px -> id);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (py -> next != NULL) {
|
||||||
|
fprintf(file, "%d", py -> listener -> id);
|
||||||
|
if (py -> next -> next != NULL) {
|
||||||
|
fprintf(file, ",");
|
||||||
|
} else {
|
||||||
|
fprintf(file, "\n");
|
||||||
|
}
|
||||||
|
py = py -> next;
|
||||||
|
}
|
||||||
|
|
||||||
px = px -> next;
|
px = px -> next;
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
|
|
||||||
void readConfs(ptConf confChain);
|
void readConfs(ptConf confChain);
|
||||||
void readListeners(ptListener listenerChain);
|
void readListeners(ptListener listenerChain);
|
||||||
|
void readRelations(ptConf confChain, ptListener listenerChain);
|
||||||
void saveConf(ptConf confChain);
|
void saveConf(ptConf confChain);
|
||||||
void saveListeners(ptListener listenerChain);
|
void saveListeners(ptListener listenerChain);
|
||||||
|
void saveRelations(ptConf confChain);
|
||||||
|
|
||||||
#endif // FILE_MANAHGER_H
|
#endif // FILE_MANAHGER_H
|
5
main.c
5
main.c
|
@ -11,11 +11,8 @@ int main()
|
||||||
|
|
||||||
readConfs(confChain);
|
readConfs(confChain);
|
||||||
readListeners(listenerChain);
|
readListeners(listenerChain);
|
||||||
|
readRelations(confChain, listenerChain);
|
||||||
menu(confChain, listenerChain);
|
menu(confChain, listenerChain);
|
||||||
|
|
||||||
saveConf(confChain);
|
|
||||||
saveListeners(listenerChain);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
BIN
main.exe
BIN
main.exe
Binary file not shown.
|
@ -253,6 +253,7 @@ void menu(ptConf confChain, ptListener listenerChain)
|
||||||
scanf("%d", &listenerId);
|
scanf("%d", &listenerId);
|
||||||
|
|
||||||
participateToConf(confChain, listenerChain, confId, listenerId);
|
participateToConf(confChain, listenerChain, confId, listenerId);
|
||||||
|
saveRelations(confChain);
|
||||||
menu(confChain, listenerChain);
|
menu(confChain, listenerChain);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue