Hi

i'm trying to read a text file into a linked list storing each word in a different node in the list.

i don't know how to tell it to stop reading when it gets to the end of the word (a space, newline or punctuation mark).

this is the code i have so far:

Code:
/* opening and reading from a file */
void readword()
{
	int n;
	char c[50];
      file *text;
      
      text = fopen("filename", "r");
   
/* here i need to tell it to stop reading when it gets to the end of the word */
   
{
	n = fread(c, 1, 50, text);
      c[n]='\n';
}

      fclose(text);
return 0;

}
thanks a lot any help will be greatly appreciated