zoukankan      html  css  js  c++  java
  • Parse the main function arguments

     1 int main(int argc, char **argv) {
     2 
     3     std::string reportDir;
     4     std::string transURL;
     5     std::string visualElement; 
     6     std::string outputFile;
     7     std::string outputType;
     8     static std::string SASFontsLoc;
     9     static std::string SASResLoc;
    10     static std::string SASLocale;
    11     int width=640, height=480; /* default */
    12     int dpi=96; /* Default DPI */
    13     int kpiIndex=0, rowIndex=0, colIndex=0, section=0;
    14     
    15     /* Parse the arguments */
    16     int idx=0;
    17     while (idx < argc)
    18     {
    19       if (strcmp(argv[idx], "-report") == 0)
    20         reportDir = argv[++idx];
    21       else if (strcmp(argv[idx], "-ve") == 0)
    22         visualElement = argv[++idx];
    23       else if (strcmp(argv[idx], "-section") == 0)
    24         section = atoi(argv[++idx]);
    25       else if (strcmp(argv[idx], "-outfile") == 0)
    26         outputFile = argv[++idx];
    27       else if (strcmp(argv[idx], "-outtype") == 0)
    28         outputType = argv[++idx];
    29       else if (strcmp(argv[idx], "-fontsloc") == 0)
    30         SASFontsLoc = argv[++idx];
    31       else if (strcmp(argv[idx], "-resourceloc") == 0)
    32         SASResLoc = argv[++idx];
    33       else if (strcmp(argv[idx], "-locale") == 0)
    34         SASLocale = argv[++idx];
    35       else if (strcmp(argv[idx], "-dpi") == 0)
    36         dpi = atoi(argv[++idx]);
    37       else if (strcmp(argv[idx], "-width") == 0)
    38         width = atoi(argv[++idx]);
    39       else if (strcmp(argv[idx], "-height") == 0)
    40         height = atoi(argv[++idx]);
    41       else if (strcmp(argv[idx], "-kpiindex") == 0)
    42         kpiIndex = atoi(argv[++idx]);
    43       else if (strcmp(argv[idx], "-rowindex") == 0)
    44         rowIndex = atoi(argv[++idx]);
    45       else if (strcmp(argv[idx], "-colindex") == 0)
    46         colIndex = atoi(argv[++idx]);
    47       else if (strcmp(argv[idx], "-tsurl") == 0)
    48         transURL = argv[++idx];
    49       idx++;
    50     }
    51    
    52     return 0;
    53 }
  • 相关阅读:
    java.util.concurrent学习
    mysql慢查优化总结
    mysql怎么限制某些查询语句的执行?
    数据库操作提交事务如果不关闭,会有什么样的后果?
    apache的500错误是写到哪个文件里面
    apache也可以做负载均衡,跟nignx的区别是什么?
    ajax提交请求为啥url要用这个函数encodeURI
    MySQL性能调优与架构设计读书笔记
    java枚举的作用
    linux的命令
  • 原文地址:https://www.cnblogs.com/leon032/p/3448108.html
Copyright © 2011-2022 走看看