how do i make my program use command line arguments? i want one to be an int, one to be a char, and the last to be a char array.
something like this:
programname help
programname 5 5 #
thanks
how do i make my program use command line arguments? i want one to be an int, one to be a char, and the last to be a char array.
something like this:
programname help
programname 5 5 #
thanks
int main(int argc, char *argv[])
argc is the number of arguments, including the program name, which is always the first argument.
argv[0]..argv[argc-1] are the arguments in order as null terminated strings. The effects of wildcards, quotes and environmental variables depends on your compiler and shell. Some usefull functions are atoi() and the boost libraries lexical_cast