C++/Development/Argv Argc — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Версия 17:21, 25 мая 2010

Outputs the program name including the path, command line arguments and the environment

<source lang="cpp">

  1. include <iostream>

using namespace std; int main( int argc, char *argv[], char *env[]) {

  cout << "Program: " << argv[0] << endl;
  cout << "Command line arguments:" << endl;
  int i;
  for( i = 1; i < argc; ++i)  
    cout << argv[i] << endl;
  cout << "Type <Return> to go on";
  cin.get();
  cout << "Environment strings:" << endl;
  for( i = 0; env[i] != NULL; ++i)
    cout << env[i] << endl;
  return 0;

}

      </source>