Command line arguments


When you write the main function you should code it in a way simular to this example.


  int main(int argc, char *argv[])
  {

  }

This enables you to access any command line arguments passed to your program and the program name its self.


Notes for Unix users

If the program has a soft link pointing to it and it is executed via the soft link, argv[0] will contain the name of the soft link i.e. the name used to start the program.


Examples:

Example using argc and argv
Bob Stout's example.

See Also:

getopt function.

Top Master Index Keywords Functions


Martin Leslie