Commit f7bba812a818a937307f2c8453156b346e941bb1

Authored by mduquesn
1 parent 327fa977

old

Showing 1 changed file with 0 additions and 64 deletions   Show diff stats
projet.c~ deleted
... ... @@ -1,64 +0,0 @@
1   -#include <stdio.h>
2   -#include <string.h>
3   -#include <stdlib.h>
4   -#include <stdbool.h>
5   -
6   -struct cell {
7   - int stop;
8   - struct cell * liste[26];
9   -};
10   -
11   -int num(char c){
12   - return 1;
13   -}
14   -
15   -int ajout_mot(struct cell ** d,char * m){
16   - char c;
17   - struct cell **tmp1 , *tmp2 ;
18   - int x=0;
19   - if (*d==NULL){return EXIT_FAILURE;}
20   - tmp1=d;
21   - c=m[x];
22   - while (c!="\0"){
23   - printf("%c",c);
24   - if ((*tmp1)->liste[num(c)]==NULL){
25   - tmp2=malloc(sizeof(struct cell));
26   - (*tmp1)->liste[num(c)]=tmp2;
27   - }
28   - tmp1=&((*tmp1)->liste[num(c)]);
29   - x++;
30   - c=m[x];
31   - }
32   - return 1;
33   -}
34   -
35   -void creation_dico(FILE *fd,struct cell **d){
36   - char s[20];
37   - while (fscanf(fd,"%s",s)==1){
38   - ajout_mot(d,s);
39   - }
40   -}
41   -
42   -int main(int argc, char *argv[])
43   -{
44   - if (argc < 2)
45   - {
46   - fprintf(stderr, "usage: hash <file_name>\n");
47   - return EXIT_FAILURE;
48   - }
49   -
50   - FILE *fp;
51   - printf("%s\n",argv[1]);
52   - fp=fopen(argv[1], "r");
53   - if (fp==NULL)
54   - {
55   - fprintf(stderr, "no such file, or unreachable: %s\n", argv[1]);
56   - return EXIT_FAILURE;
57   - }
58   - struct cell *d;
59   - d=malloc(sizeof(struct cell));
60   - //creation_dico(fp,&d);
61   - char s[]="helo\0";
62   - ajout_mot(&d,s);
63   -
64   -}