; return NULL ; } for ( i = 0 ; _fgets(buf1,255,fp) ; i ++ ) ; if ( ! i ) { fclose(fp) ; return NULL ; } my_fgets_names = (char**) calloc ( i, sizeof(char*) ) ; rewind ( fp ) ; i = 0 ; while ( _fgets(buf1,255,fp) ) { buf1[255] = 0 ; if ( 1 == sscanf(buf1,"%s",buf2) ) { my_fgets_names[i] = strdup(buf2) ; i ++ ; } } fclose ( fp ) ; my_fgets_number_of_names = i ; if ( my_fgets_debug_flag ) { printf ( "libfgets: successfully read %d commands\n", i ) ; } } if ( index < my_fgets_number_of_names ) { return my_fgets_names[index] ; } else { return NULL ; } }