• main函数的参数的用法


    说明:
    main函数的参数的用法
    源代码:

    #include <stdio.h>
    #include <stdlib.h>
    int main(int argc, char *argv[], char *env[])
    {
      int i = 0;
      printf("Address of Arguements is [%p]. ", (void*)argv[0]);
      printf("Argument(s) number is [%d]. List: ", argc);
      for(i=0; i<argc; i++)
        printf(" argv[%d] [%s] ", i, argv[i]);

      printf(" Address of Environments is [%p]. ", (void*)env[0]);
      printf("Environment list on this system is: ");
      for(i=0; env[i]!=NULL; i++)
           printf(" env[%d] [%s] ", i, env[i]);

      return 0;
    }

    程序处理结果(其中环境变量是部分显示):
    Address of Arguements is [00821790].
    Argument(s) number is [1]. List:
        argv[0]    [D:projectseclipsecpptestDebugcpptest.exe]

    Address of Environments is [00822188].
    Environment list on this system is:
        env[0]    [ACE_ROOT=D:ACE-6.1.0ACE_wrappers]
        env[1]    [ACPath=C:Program FilesLenovoAccess Connections]
        env[2]    [ALCKPath=C:Program FilesLenovoAutoLock]
        env[3]    [ALLUSERSPROFILE=C:ProgramData]
        env[4]    [AMDAPPSDKROOT=C:Program FilesAMD APP]
        env[5]    [APPDATA=C:UsersBabyAppDataRoaming]
        env[6]    [asl.log=Destination=file]

    说明
        略。

  • 相关阅读:
    Android Camera 使用小结
    Android 调用堆栈跟踪
    读取文件
    Android USB大容量存储时SD卡状态监听(转)
    Setting up PhoneGap on Ubuntu for Android app development
    python单元测试
    python数据库备份
    python多线程多进程
    python面向对象编程和类
    python异常处理及Url编码
  • 原文地址:https://www.cnblogs.com/babyha/p/3469482.html
Copyright © 2020-2023  润新知