Created
October 31, 2019 14:46
-
-
Save varvaruc/4376b9dba0ddbc62ebd4a19358c0a8b0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
int main(int argc, char **argv) { | |
vector<string> args(argv + 1, argv + argc); | |
string infname, outfname; | |
// Loop over command-line args | |
// (Actually I usually use an ordinary integer loop variable and compare | |
// args[i] instead of *i -- don't tell anyone! ;) | |
for (vector<string>::iterator i = args.begin(); i != args.end(); ++i) { | |
if (*i == "-h" || *i == "--help") { | |
cout << "Syntax: foomatic -i <infile> -o <outfile>" << endl; | |
return 0; | |
} else if (*i == "-i") { | |
infname = *++i; | |
} else if (*i == "-o") { | |
outfname = *++i; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment