HERE IS THE SOURCE CODE I USED.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NJFD 3059
main(int argc, char **argv){
FILE *fict;
unsigned short int *data_tab;
char line[1024];
char *cp;
char *n[10000];
char *(*n_ptr)[10000] = &n;
int m,i,quit;
/****** Open files and initialize ******/
if (argc != 2) {
printf("\n command line: <List File> \n");
exit(1);
}
if ( (fict = fopen(argv[1],"r")) == NULL ) {
printf("\n Cannot OPEN TAB file 1\n");
exit(1);
}
data_tab = (unsigned short int *)calloc(NJFD, sizeof(unsigned short int));
if (data_tab == NULL) {
printf("\n Not enough memory for tab data short int array \n");
exit(1);
}
m = 0;
quit = 0;
if(fict != NULL)
{
while((fgets(line, 1024, fict)) && (quit == 0))
{
cp = line;
while((*cp != '\0') && (quit == 0))
{
if((m < 10000))
{
n[m] = cp;
while((*cp != ',') && (*cp != '\0')){
cp++;
}
if(*cp == ',') cp++;
} /* end if */
else
{
quit = 1;
fprintf(stderr, "Error: Rows has exceeded 10000. Exiting program.\n");
} /*end else */
} /* end while ((*cp */
m++;
} /* end while ((fgets */
fclose(fict);
} /*end if (fict */
else
{
fprintf(stderr, "Error: Unable to open textfile.\n");
}
for (i = 0; i < m; i++) printf("List %d: %s\n",i+1, (*n_ptr)[i]);
if (data_tab != NULL) free(data_tab);
}