:
This message was edited by stober at 2007-1-27 10:25:24
: : I mixed up.
: :
: : struct dictionary{
: : char word[50];
: : char translation[50];
: : char wordtype[10];
: : }voc;
: :
: : but that's not the case here. so do I use fseek()? I just couldn't use it.
: : dede

: :
: :
:
: why are you using fseek() ? There is no need for it. Just start at the beginning of the file and sequentually read it one word at a time until you find the word you want.
:
:
: FILE *fp = fopen("filename.txt","r");
: char word[50] = {0};
: if(fp != NULL)
: {
: while( fscanf(word,"%s",word) > 0)
: {
: // do something with this word
:
: }
: }
:
:
: or if you are writing c++ code
:
: ifstream in("filename.txt");
: std::string word;
: while( in >> word )
: {
: // do something with this word
: }
:
:
:
:
It will probably suffice for this case, but I'm pretty sure that's not how it is done in relational or OO SQL databases.
If I was some DB guru writing a DBMS I would implement it as a hash table and I would probably upload parts of the file(s) to RAM in some smart way before searching. Since hash tables won't get slower when the amount of data increases.