Have a problem with fscanf() - it does not skip to the next word after reading 10 characters from the file
while(fscanf(TEXT_FILE,"%10s", str) != EOF) // reads up to 10 char ...