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

Started by dhilipkumar, Mar 07, 2009, 08:51 PM

Previous topic - Next topic

dhilipkumar

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



#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 << endl;
   cout << "Type <Return> to go on";
   cin.get();
   cout << "Environment strings:" << endl;
   for( i = 0; env != NULL; ++i)
     cout << env << endl;
   return 0;
}