From b2638a8a96e1a9614d9e0695076fd1c88bd4598e Mon Sep 17 00:00:00 2001 From: Baptiste JL Date: Sun, 5 May 2019 09:45:24 +0200 Subject: [PATCH] création rapport --- dico.c | 2 +- main.c | 20 +++++++++++++++----- rapportDico.odt | Bin 0 -> 7388 bytes treeh.c | 1 + 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 rapportDico.odt diff --git a/dico.c b/dico.c index 3ebb1a4..037af67 100644 --- a/dico.c +++ b/dico.c @@ -165,7 +165,7 @@ void test_words(dico d,FILE*inStream,FILE*outStream){ if(isIn<1){ if(someWrong==0){ someWrong=1; - fprintf(outStream,"Voici les mots absent du dictionnaire"); + fprintf(outStream,"Voici les mots absent du dictionnaire\n"); } fprintf(outStream,"%s est absent dans le dictionnaire",word); if(isIn) diff --git a/main.c b/main.c index 69ce860..b711cfc 100644 --- a/main.c +++ b/main.c @@ -42,6 +42,8 @@ void menu(dico monDico){ //initialisation printf("Pour commencer, veuillez charger un dictionnaire.\n"); FILE*fileIn=getFile("r"),*fileOut=stdout; + if(fileIn==stdin) + printf("Entrez vos mots (ctrl-D pour terminer le chargement):\n"); loadfrom_file(monDico,fileIn); fclose(fileIn); @@ -63,8 +65,9 @@ void menu(dico monDico){ //out stream printf("6) Définir un fichier de sortie.\n"); printf("7) Définir la sortie sur le terminal.\n"); - - scanf("%1s",word); + + //saisie du choix + scanf("%2s",word); choice=ctoi(*word); switch(choice){ @@ -80,8 +83,11 @@ void menu(dico monDico){ //manip sur le dictionnaire case 2: {//ajout fileIn=getFile("r"); + if(fileIn==stdin) + printf("Entrez vos mots (ctrl-D pour terminer le chargement):\n"); loadfrom_file(monDico,fileIn); - fclose(fileIn); + if(fileIn!=stdin) + fclose(fileIn); break;} case 3: {//effacer delete_dico(monDico); @@ -91,14 +97,18 @@ void menu(dico monDico){ delete_dico(monDico); fileIn=getFile("r"); loadfrom_file(monDico,fileIn); - fclose(fileIn); + if(fileIn!=stdin) + fclose(fileIn); break;} case 5: {//faire des tests fileIn=getFile("r"); + if(fileIn==stdin) + printf("Entrez vos mots (ctrl-D pour terminer les tests):\n"); test_words(monDico,fileIn,fileOut); - fclose(fileIn); + if(fileIn!=stdin) + fclose(fileIn); break;} //définir la sortie des tests et de "Lire" le dictionnaire diff --git a/rapportDico.odt b/rapportDico.odt new file mode 100644 index 0000000..691216d Binary files /dev/null and b/rapportDico.odt differ diff --git a/treeh.c b/treeh.c index fae6b94..f22e864 100644 --- a/treeh.c +++ b/treeh.c @@ -26,6 +26,7 @@ void delete_tree(tree *t){ for(int i=0;inext[i])); free(*t); + *t=NULL; } -- libgit2 0.21.2