|
args
argv is a double pointer to strings. Just dumping the pointer to stdout won't work out very well. Consider traversing the array, using argc to resolve the end of the list of pointers.
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
using namespace std;
int main(int argc,char** argv)
{
vector<string> args;
for (int i=1;i<argc;i++)
{
args.push_back(argv[i]);
}
for (vector<string>::iterator it=args.begin();it!=args.end();it++)
{
string& s=*it;
cout<<s<<endl;
}
return 0;
}
|