Monday, November 30, 2009

Syntax of main(int argc , char* argv[])

argc is the number of items or arguments on the command line that were used to write the program.
argv[0] is the name of the program
argv[1] is the first command line parameter
argv[argc-1] is the last command line parameter
argv[argc] is always a null pointer
so, if we have " $ RemOrder Orders.bin NewSOrders.bin 20 " in our command line.

argc == 4
argv[0] == RemOrder ( name of program which parameter to run )
argv[1] == Orders.bin
argv[2] == NewSOrders.bin
argv[3] == 20

No comments:

Post a Comment