int i=0;
int numProgs=0;
char* input[500];
char line[500];
FILE *file;
file = fopen(argv[1], "r");
while(fgets(line, sizeof line, file)!=NULL) {
/*check to be sure reading correctly
add each filename into array of input*/
input[i] = (char*)malloc(strlen(line)+1);
strcpy(input[i],line);
printf("%s",input[i]);/*it gives the hole line with\n*/
i++;
/*count number of input in file*/
numProgs++;
}
/*check to be sure going into array correctly*/
fclose(file);
I don't know the size of the input txt for each line so i need to do it dynamically. I need to use char* input[] this type of array and also i need to hold line numbers with int numProgs. Input text file has multiple lines and each line has unknown size of character.