I have too make an application in C that uses a dictionary. I have 54000 words in a file, on per line and I need a way to handle it.
- I first wanted to keep it in an array but as it's bigger that INT (32767) I cannot do that.
- The second option is to keep all in a very long string but it seems it give me some errors and throws me out of program. I tried to use a pointer for char like this:
FILE *f=fopen("d.txt","r");
char *line;
while(fgets(line,sizeof(line),f)){
strcat(str,line);//concatenate all strings to this one - does not work, the pointer does not contain that words...
// printf("%s\n",line);
}
fclose(f);
Is there a way too keep this dictionary in a variable in C? I don't want too search in the file every time cause it's time consuming and not reliable.
Thanks!