Boost logo

Boost Users :

Subject: Re: [Boost-users] commandline args
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2009-08-23 13:57:00


Hi!

Take a look at boost program_options library:

http://www.boost.org/doc/libs/1_39_0/doc/html/program_options.html

Regards,
Ovanes

On Sun, Aug 23, 2009 at 7:31 PM, Shaolin <shaolinfinest_at_[hidden]> wrote:

> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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