#include "stdio.h" #include "stdlib.h" #include "string.h" #include "flatfile.h" #include "astring.h" int rdhead(int unit, char *vn, char *vu, char *vs, char *vt, char *no, char *stime, char *etime, long *nrow, int *ncol, int *csize) { FILE *fp; int error, temp,i; char line[80], hline[80]; long pos1, pos2, len; int fline, strll; error = 0; if (!ff_pointer_h[unit]) { printf("Header file is not opened - Error.\n"); error = 1; } if (!error) { fp = ff_pointer_h[unit]; rewind(fp); for (i=0;i<3;i++) { fgets(line,79,fp); } csize[0] = atoi(strmid(line,40,strlen(line)-40-1)); fgets(line,79,fp); ncol[0] = atoi(strmid(line,40,strlen(line)-40-1)); fgets(line,79,fp); strcpy(hline,strmid(line,40,strlen(line)-40-1)); strcat(hline,".0"); nrow[0] = (long) atof(hline); for (i=0;i<4;i++) { fgets(line,79,fp); } for (i=0; i 1) { if (fline) { strcpy(no,strmid(line,0,strlen(line)-1)); fline = 0; } else { strcat(no,","); strcat(no,strmid(line,0,strlen(line)-1)); } } fgets(line,79,fp); } } }