Skip to content

Instantly share code, notes, and snippets.

@z4none
Last active August 2, 2020 01:32
Show Gist options
  • Save z4none/1f1047ce2b5864985aeae68824e323d8 to your computer and use it in GitHub Desktop.
Save z4none/1f1047ce2b5864985aeae68824e323d8 to your computer and use it in GitHub Desktop.
[has_arg] 命令行参数知否包含指定 option #c,#c++
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