#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;
}
结果为:输出程序编译生成的exe文件的路径和运行参数,然后点击回车后,输出环境变量.
posted on 2006-07-22 01:36 活着就是折腾,所以当然要骠悍的折腾 阅读(834) 评论(0)  编辑 收藏 引用 所属分类: C++基础