argproc.cpp

来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架&gt」· C++ 代码 · 共 44 行

CPP
44
字号
//start#include <cstring>bool test = false;bool verbose = false;void processFile(char* filename) {//endif (test) { /* do a test on FileName */    }    else { /* do the other thing */    }        if (verbose)  { /* output lots of detail */    }    else { /* brief output */    }//start}/*  @param argc - the number of arguments  @param argv - an array of argument strings*/int main (int argc, char *argv[]) {    // recall that argv[0] holds the name of the executable.    for (int i=1; i < argc; ++i) { /* first process the switches */        if (strcmp(argv[i], "-v")==0) {            verbose = true;        }        if (strcmp(argv[i], "-t") ==0) {            test = true;        }    }    for (int i=1; i < argc; ++i) { /* make a second pass                   to operate on the non-switched arguments */        if (argv[i][0] != '-')             processFile(argv[i]);    }}//end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?