/* Program: BIGARRAY.H Author : Kim Moser Date : 11/17/1991 System : IBM PC / Borland Turbo C 2.0 Descrip: Disk-based arrays */ #include #include typedef long index_type; typedef struct { char *fname; FILE *fp; index_type num_elmts; size_t elmt_size; void *last_elmt; /* Copy of last elmt read */ index_type last_elmt_index; /* Index of last elmt read */ index_type file_pointer_index; /* What elmt file pointer is at */ } BigArray; extern BigArray *BigArray_calloc(char *fname, index_type num_elmts, size_t elmt_size); /* Initializes array, using file 'fname'. */ extern int BigArray_free(BigArray *array); /* Frees array (deletes file). Returns whether successful. */ extern void *BigArray_element(BigArray *array, index_type i, void *dest); /* If 'dest' != NULL, copies i'th element of array to 'dest' and returns 'dest', else returns pointer to temporary copy of i'th elmt. */ extern int BigArray_assign(BigArray *array, index_type i, void *src); /* Copies 'src' to i'th element of array. */