/* priklad pr8_7.c citanie po riadkoch   */
#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 = fgets(oneword,100,fp);  /* get one word from the file */
      if(c != NULL) printf("%s",oneword);     /* display it on the monitor */
    } while (c != NULL);  /* repeat until EOF (end of file) */
  }
  fclose(fp);
}