Parse a large text file and store it in a tree (Binary or AVL) using C++
<p>I am doing an assignment, in which I have a large text file (1gb). I am supposed to parse this text file and store it in a tree for some operations. The problem I am facing is the time it takes to completely parse the whole file. It takes about 40 min to completely parse the file. Can anyone please show me how to do it efficiently in a few minutes?
My code is</p>

<pre><code>int main()
{
FILE * file=fopen("data.txt","r");
char line[1000];
char *token;

while(fgets(line,1000,file)!=NULL) 
{
    token=strtok(line,"     ");
    while(token!=NULL)
    {
        cout&lt;&lt;token&lt;&lt;endl;
        token=strtok(NULL,"     ");
    }
}

fclose(file);
return 0;

}
</code></pre>
