What do you want to do with them?
A simple example of usage is like the following:
// Get numbers from the command line, and put them in a vector.
int main(int argc, char* argv[])
{
/* get the numbers from the command line. For example:
$ my_prog 1 2 3 4 5 6 7 8 9 10
*/
std::vector<int> numbers(argc-1);
try
{
std::transform(argv+1, argv+argc, numbers.begin(),
boost::lexical_cast<int, char*>);
}
catch(const std::exception&)
{
std::cout << "Error: You have entered invalid numbers.";
}
}
It depends on what you are trying to do. If you have many types of arguments etc.. Then it is better to use something like boost program options
.