int main(int argc, char *argv)
{
char filename[20]={};
int count=0;
if(argc==2)
{
strcpy(filename, argv[1]);
}
else
{
printf("Need 2 command line parameters\n");
}
FILE *fp=fopen(argv[1], "r");
while(fgets(filename, 20, fp))
{
count++;
}
fseek(fp, 0, SEEK_SET);
int ptr=(int)malloc(count*sizeof(int));
while(fgets(filename, 20, fp))
{
ptr[i]=
}
return 0;
for example, my numbers in file are 19293 18239 19405 29302 10492 in each line, and I would like to put each line in an array. How do I do this? It doesn't have to be in a while loop.