/* --------------------------------------------*\
| files.inc (version 1.2) - (C) SichemSoft 1993 |
| Roghorst 160, 6708 KS Wageningen, Netherlands |
| include for language independent applications |
| author: Anneke Sicherer-Roetman, date: 930521 |
\* --------------------------------------------*/

#include <stdio.h>

static FILE *fp=NULL;             /* file pointer */

/* opens named file (returns 1 on ok, 0 on not ok) */
#define fileopen(name)            ((fp=fopen(name,readRA))!=0)

/* closes file */
#define fileclose()               if (fp) { fclose(fp); fp=NULL; }

/* moves file pointer to pos (1=ok,0=not ok) */
#define fileseek(pos)             (fp?!fseek(fp,pos,SEEK_SET):0)

/* returns file pointer value */
#define filetell()                (fp?ftell(fp):-1)

/* reads num bytes from file into buffer (1=ok,0=not ok) */
#define fileread(buffer,num)      (fp?fread(buffer,num,1,fp)==1:0)

