#include #include #include #define NT 46 #define LEN 500 int main( int argc, char *argv[] ) { char line[LEN], inname[8], d[12], t[8]; static char name[NT][8] = { "MET4133", "MET4375", "MET4300", "MET4324", "MET4283", "MET4282", "MET3070", "MET4288", "MET4061", "MET4296", "MET4313", "MET0091", "MET2700", "MET3150", "MET3155", "MET3315", "MET3350", "MET3355", "MET3411", "MET3412", "MET3415", "MET4059", "MET4082", "MET4084", "MET4095", "MET4096", "MET4102", "MET4104", "MET4124", "MET4140", "MET4172", "MET4173", "MET4186", "MET4188", "MET4189", "MET4190", "MET4201", "MET4256", "MET4257", "MET4281", "MET4293", "MET4312", "MET4118", "MET3145", "MET3065", "MET3409" }; int i, j, count[NT],ncount,ncount6; size_t seven = 7; float s; FILE *fni, *fno; for( i = 0; i < NT; i++ ) count[i] = 0; ncount = ncount6 = 0; fni = fopen( argv[1], "r" ); if( fni != NULL ) { while( fgets( line, LEN, fni ) != NULL ) { for( j = 0; j < NT; j++ ) { sscanf(line,"%s%s%s%f", &inname[0], &d[0], &t[0], &s); /* strncpy( inname, line, seven ); */ if( strncmp( inname, name[j], seven ) == 0 ) { if( s > -9000.0 ) count[j]++; break; } } /* for( j = 0; j < NT; j++ ) */ } /* while( fgets( line, LEN, fni ) != NULL ) */ } /* if( fni != NULL ) */ fclose(fni); /* Now write out the JavaScript var locations array */ for( i = 0; i < NT; i++ ) { if( count[i] > 0 ) ncount++; if( count[i] == 6 ) ncount6++; } printf("%s %2d %2d\n", argv[1], ncount, ncount6); }