Hello,
I am trying to make a program that will open up as many files as the user specifies in the command line (argv) and compare each file to see which has the most characters(bytes) and which file has the most words inside of it. I am having trouble figuring out how to manipulate the argv array so that i can accompany many user inputted filenames. i was thinking argv[i] and creating a loop, but i do not think that it works. Anyway can someone help me out here?
Code:#include <stdio.h>
#include <stdlib.h>
int i;
int main(int argc,char **argv[])
{
char name[100],name2[100],d;
int c,nw[w],w,numfile;
FILE *f[n],*g;
n=0;
numfile=argc;
for (i=1;argv <= numfile;i++){
f[n]=fopen(argv[i],"r");
if(f[n]==NULL){
printf("Can't open %s \n",argv[i]);
exit(0);
}
}
// fgetc(f[n]);
// while(c != EOF){
//fputc(c,g);
// c=getc(f);
}

