Skip to content

Instantly share code, notes, and snippets.

View ggssh's full-sized avatar
:shipit:
Focusing

Yizhe Yuan ggssh

:shipit:
Focusing
View GitHub Profile
@plasticbox
plasticbox / getcmdoption.cpp
Last active August 7, 2022 19:57
Simple Parse Command Line Arguments in C++
std::string getCmdOption(int argc, char* argv[], const std::string& option)
{
std::string cmd;
for( int i = 0; i < argc; ++i)
{
std::string arg = argv[i];
if(0 == arg.find(option))
{
std::size_t found = arg.find_first_of(option);
cmd =arg.substr(found + 1);