I want my program to loop until there are no more command line arguments to process. Or do nothing if no arguments were entered. The command line arguments will be files that need to be read in. The user would be able to enter multiple files to be read in, or 1..or even none.
is it argc that contains the number of paramters entered in command line? When you type the program name, i.e program parameter1 paramter2...is the program name a parameter as well? would you start from argv[1] instead of argv[0] ?Code:int main( int argc, char *argv[] ) { //how can I tell if any arguments exist in the command line? for( i=0; i < number of command line arguments; i++ )//how can i tell how many there are to process? { input = fopen( argv[i], "r" ); //try reading the file passed as an argument in command line } }