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 }
  • 相关阅读:
    Android批量插入数据库提升速度(9.9)
    Android中database所在文件夹路径(9.6)
    Eclipse更改默认工作环境编码为UTF-8(9.6)
    Android下Sqlite的使用(9.7)
    Android下ListView的分页(9.6)
    【转】Tarjan算法 资料合集
    【转】BYV--有向图强连通分量的Tarjan算法
    Codeforces Round #403---C题(DFS,树)
    codeforces#403—B题(二分,三分)
    【转】毛虫算法——尺取法
  • 原文地址:https://www.cnblogs.com/leon032/p/3448108.html
Copyright © 2011-2022 走看看