I have read a file with around 120k words so i try to do it fast.
have seen the:
int x = setvbuf(fp, (char *)NULL, _IOFBF, BSZ);
assert( x == 0 && fp != NULL );
option but it takes more than a second ( 1 mb file)
so now i tried this method :
fopen_s (&pFile,DICT,"rb");
if (pFile==NULL) {fputs ("File error",stderr); exit (1);}
// obtain file size:
fseek (pFile , 0 , SEEK_END);
lSize = ftell (pFile);
rewind (pFile);
// allocate memory to contain the whole file:
buffer = (char*) malloc (sizeof(char)*lSize);
// copy the file into the buffer:
result = fread (buffer,1,lSize,pFile);
how do i continue from here?
buffer holds a list of words and i want to get them one by one as fast as possible
because im building a multimap with those words.
thank you!
I would read all the words like so: