Skip to content

Instantly share code, notes, and snippets.

@trevorrjohn
Created November 19, 2012 04:21
Show Gist options
  • Save trevorrjohn/4108934 to your computer and use it in GitHub Desktop.
Save trevorrjohn/4108934 to your computer and use it in GitHub Desktop.
argv example
// if we had the program
int main(int argc, char* argv[]) {
cout << "output is: ";
for(int i = 0; i < argc; i++)
cout << argv[i] << ", ";
cout << endl;
return 0;
}
// Given this input
$ ./a.out a b c
output is: a.out, a, b, c,
$ ./a.out -f somefile
output is: a.out, -f, somefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment