From f7bba812a818a937307f2c8453156b346e941bb1 Mon Sep 17 00:00:00 2001 From: mduquesn Date: Tue, 23 Apr 2019 09:31:06 +0200 Subject: [PATCH] old --- projet.c~ | 64 ---------------------------------------------------------------- 1 file changed, 0 insertions(+), 64 deletions(-) delete mode 100644 projet.c~ diff --git a/projet.c~ b/projet.c~ deleted file mode 100644 index 9cadbd3..0000000 --- a/projet.c~ +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include - -struct cell { - int stop; - struct cell * liste[26]; -}; - -int num(char c){ - return 1; -} - -int ajout_mot(struct cell ** d,char * m){ - char c; - struct cell **tmp1 , *tmp2 ; - int x=0; - if (*d==NULL){return EXIT_FAILURE;} - tmp1=d; - c=m[x]; - while (c!="\0"){ - printf("%c",c); - if ((*tmp1)->liste[num(c)]==NULL){ - tmp2=malloc(sizeof(struct cell)); - (*tmp1)->liste[num(c)]=tmp2; - } - tmp1=&((*tmp1)->liste[num(c)]); - x++; - c=m[x]; - } - return 1; -} - -void creation_dico(FILE *fd,struct cell **d){ - char s[20]; - while (fscanf(fd,"%s",s)==1){ - ajout_mot(d,s); - } -} - -int main(int argc, char *argv[]) -{ - if (argc < 2) - { - fprintf(stderr, "usage: hash \n"); - return EXIT_FAILURE; - } - - FILE *fp; - printf("%s\n",argv[1]); - fp=fopen(argv[1], "r"); - if (fp==NULL) - { - fprintf(stderr, "no such file, or unreachable: %s\n", argv[1]); - return EXIT_FAILURE; - } - struct cell *d; - d=malloc(sizeof(struct cell)); - //creation_dico(fp,&d); - char s[]="helo\0"; - ajout_mot(&d,s); - -} -- libgit2 0.21.2