📄 argproc.cpp
字号:
//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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -