1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to keep a word dictionary in one variable

Discussion in 'C' started by Clawsy, Sep 8, 2010.

  1. Clawsy

    Clawsy New Member

    Sep 8, 2010
    Likes Received:
    Trophy Points:
    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;
         strcat(str,line);//concatenate all strings to this one - does not work, the pointer does not contain that words...
         //  printf("%s\n",line);
    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.


Share This Page