Well, so far I have this program reading the first 10 words of a file. But what I need it to do is read all of the words, sort the words, count the words, and print the first and last 10 words of the unsorted, then read the first and last 10 words of the sorted. So as you can see I'm so far away. But what I need help with right now is sorting all the words. Here's the fragment of my code that reads from the file. Any suggestions?
if( myfile != NULL)
{
for(a=0; a<10; a++)
{
/* Get one line */
fgets(Buffer, 5000, myfile);
if (!feof(myfile))
{
/* Break the line up into words */
token = strtok(Buffer, delimiters);
while (token != NULL)
{
puts(token);
/* Get the next word */
token = strtok(NULL, delimiters);
}
}
}
fclose( myfile );
}