4 char *leer_linea(FILE *fp)
7 char tmp[255]; /* Hack! */
8 if (feof(fp)) return NULL;
10 fscanf(fp, "%[^\n]", tmp); /* Leo una linea */
11 fgetc(fp); /* saco el \n */
12 if (strlen(tmp) == 0) return NULL;
13 ret = malloc(sizeof(char)*(strlen(tmp)+1));
18 t_Dict* dict_crear(const char *f)
22 unsigned int count = 0;
26 if (fp == NULL) return NULL;
28 tmp = (t_Dict *)malloc(sizeof(t_Dict));
29 if (tmp == NULL) return NULL;
38 tmp->array = (char **)realloc(tmp->array, sizeof(char *)*count);
39 tmp->array[count-1] = s;
48 void dict_destruir(t_Dict *d)
51 for(i=0; i<d->total; i++)
57 char *dict_get_al_azar(t_Dict *d)
59 return dict_get(d, al_azar(0, d->total));
62 char *dict_get(t_Dict *d, unsigned int pos)