/*************************************************************** FLATFILE.C August, 1987 modified October 17, 1987 Routines for reading simple arrays: FUNCTIONS: int read_array_?(fp, array, n, format) PROTOTYPES: flatfile.h VARIATIONS: ? can be 1 for any char or byte type, 2 for any 2-byte int type, 4 for any 4-byte int type, float, double. ARGUMENTS: fp is a pointer to type FILE, already open; array is the address of an array of the appropriate type; n is the number of elements to be printed or read; ncol is the number of columns for printing only; format is a standard printf format specification string: e.g. " %10.3f " RETURNS: read_array_? ----> number of fields read. **********************************************************************/ #include "common.h" #include "vector.h" int read_array_1(FILE *fp_in, char array[], int n, char format[]) { int i; int count = 0; int ok = 1; for (i=0; i