#include "stdio.h" #include "string.h" #include "flatfile.h" /* -------------------------------------------------------------------------- openhead - opens the header file for a certain flatfile, and returns an error code, if the file doesn't open. READ & WRITE! ----------------------------------------------------------------------------*/ int openhead_rw(char *filename) { int lu, error; char lfn[100]; error = 0; if (ff_opened == MAX_N_FF) { printf("Too many flat files opened.\n"); error = 1; } else { ff_opened++; lu = 0; while (ff_pointer_h[lu]!=NULL) lu++; strcpy(lfn, filename); ff_pointer_h[lu] = fopen(strcat(lfn,".hed"),"r+"); ff_readwrite[lu] = 1; if (ff_pointer_h[lu] == NULL) { error = 1; printf("Error opening header file - does file exist?\n"); } else { error = 0; } } if (error) lu = -1; return lu; }