|
Boost Users : |
Subject: Re: [Boost-users] commandline args
From: Roman Shmelev (rshmelev_at_[hidden])
Date: 2009-08-23 13:40:50
Dear Shaolin,
First, please get acquainted with this, it is really useful to read this:
Second, boost::program_options may help you, if I understand what you need.
Please, make some investigation and tries - before asking other boost
users about some question.
It will make people think you respect time of others.
2009/8/23 Shaolin <shaolinfinest_at_[hidden]>:
> Hi Guys
> Below is my current code used to retrieve commandline arguments:
>
> int i = 1;
> while (i < argc)
> {
> if (strcmp(argv[i], "-f") == 0)
> {
> for (++i; i < argc && strcmp(argv[i], "-s") != 0; ++i) {
> filearr.push_back(argv[i]);
> }
> }
> else if (strcmp(argv[i], "-s") == 0)
> {
> for (++i; i < argc && strcmp(argv[i], "-f") != 0; ++i) {
> searchtext = argv[i];
> }
> }
> else
> {
> ++i;
> }
> }
>
> As you can see, its not very scalable. I am thinking of adding another
> feature args but it'll become difficult to manage. Is there anything on
> boost which does the same thing albeit with alot less code ?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net