Last active
August 2, 2020 01:32
-
-
Save z4none/1f1047ce2b5864985aeae68824e323d8 to your computer and use it in GitHub Desktop.
[has_arg] 命令行参数知否包含指定 option #c,#c++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static bool | |
has_arg(int argc, char **argv, const char *arg) | |
{ | |
for (int i = 1; i < argc; i++) { | |
if (strcmp(argv[i], arg) == 0) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment