Hi,
how to accept command line arguments in C++ ? (how to accept more than one argument?)
Thanks
Jane
Command line argument
Re: Command line argument
To accept command line arguments, we need to define the main() as follows.
argc is the number of arguments passed in command line
argv is an array of C strings with the value of the arguments passed to your program
Note that argv[0] is always the name of your program
Code: Select all
int main ( int argc, char *argv[] )
argv is an array of C strings with the value of the arguments passed to your program
Note that argv[0] is always the name of your program