----------------------------------------------------------------
readfile.c - Functions for reading words and numbers from a file
----------------------------------------------------------------

Functions:
---------
int readtok(const char *filename,const char *word) - reads file;
int tkgetint() - returns value of integer from file;
float tkgetfloat() - returns floating point number from file;
int tkgetword() - returns number associated with word (see example program below);
void tkgetstring(char *s) - reads string of characters from file and writes it into *s,
                            for which memory must be allocated in advance;
int chkint(char *s) - returns 1 if *s is integer, 0 if not;
int chkfloat(char *s) - returns 1 if *s is floating point number, 0 if not;
int chkword(char *s) - returns 1 if *s is word (only letters), 0 if not;
void printtok() - prints description of what was found with tkget...();
void freetok() - frees memory and closes file.


Example program:
---------------
#include <stdio.h>
#include <stdlib.h>
#include "graphics.h"

int main(){
  int i;
  float f;

  readtok("file1","point:line");
  /*reads file "file1", in which words "point" and "line" will be recognized;
  function tkgetword() will return 1 if word "point" is  found and 2 if word "line" is found*/

  i=tkgetint(); printtok(); printf("; i=%d\r\n",i);
  i=tkgetint(); printtok(); printf("; i=%d\r\n",i);
  i=tkgetint(); printtok(); printf("; i=%d\r\n",i);
  f=tkgetfloat(); printtok(); printf("; f=%f\r\n",f);

    readtok("file2","point:line");
    /*a new file can be read before the previous one is finished*/

    i=tkgetint(); printtok(); printf("; i=%d\r\n",i);
    i=tkgetint(); printtok(); printf("; i=%d\r\n",i);
    i=tkgetint(); printtok(); printf("; i=%d\r\n",i);

    freetok();
    /*finished with "file2", back to "file1"*/

  i=tkgetword(); printtok(); printf("; i=%d\r\n",i);
  i=tkgetword(); printtok(); printf("; i=%d\r\n",i);
  i=tkgetint(); printtok(); printf("; i=%d\r\n",i);
  i=tkgetword(); printtok(); printf("; i=%d\r\n",i);
  i=tkgetword(); printtok(); printf("; i=%d\r\n",i);

  freetok();
  /*free memory used for "file1"*/

  return 0;
}


Compilation of the program above:
--------------------------------

gcc:
---
gcc -c readfile.c
gcc -c program.c
gcc readfile.o program.o -o program

OpenWatcom:
----------
wcc386 readfile.c
wcc386 program.c
wlink option quiet file readfile.obj file program.obj name program.exe
