/* priklad pr8_6.c  spravne citanie po slovach   */
#include "stdio.h"

void main(void)
{
  FILE *fp;
  char oneword[100];
  char c;

  fp = fopen("S.TXT","r");
  if (fp == NULL) printf("File S.TXT doesn't exist\n");
  else
  {
    do
    {
      c = fscanf(fp,"%s",oneword);  /* get one word from the file */
      if(c != EOF) printf("%s\n",oneword);     /* display it on the monitor */
    } while (c != EOF);  /* repeat until EOF (end of file) */
  }
  fclose(fp);
}