Source of listclps.cpp


  1: // Filename: LISTCLPS.CPP
  2: // Purpose:  Displays a list of all command-line parameters (CLPs).

  4: #include <iostream>
  5: using namespace std;

  7: void DisplayCLPs(int, char* []);

  9: int main(int argc, char* argv[])
 10: {
 11:     cout << "\nThis program illustrates the reading "
 12:          << "of \"command-line parameters\" and the \n"
 13:          << "use of an array of character pointers as "
 14:          << "the second parameter of main for \n"
 15:          << "the repository of those parameters. \n\n";

 17:     DisplayCLPs(argc, argv);

 19:     return 0;
 20: }


 23: void DisplayCLPs(int argc, char* argv[])
 24: {
 25:     cout << "Here is a list of the "      << argc
 26:          << " command line parameters: "  << endl;
 27:     for (int i = 0; i < argc; i++)
 28:         cout << argv[i] << endl;
 29: }