/* GOLDFISH CLUB example program */ #include #include #define MAX_NUM_ENTRIES 500 #define MAX_LINE_LENGTH 99 char database[MAX_NUM_ENTRIES][MAX_LINE_LENGTH]; int num_entries=0; void read_data(char *filename); /* prototypes because our compiler whines too much */ void print_data(void); void main(int argc, char *argv[]) { char *filename=NULL, *progname; int i; progname=argv[0]; /* program name (= command typed) always comes first */ for (i=1; i=MAX_NUM_ENTRIES) { printf("** File Too Long! Buy The Upgrade!!! **\n"); exit(1); } t=fgets(database[num_entries], MAX_LINE_LENGTH, f); if (t==NULL) break; len=strlen(database[num_entries]); database[num_entries][len-1]=0; num_entries+=1; } fclose(f); printf("[%d entries read]\n", num_entries); } void print_data(void) { int i; printf("[%d entries]\n", num_entries); for (i=0; i