The problem is that your user still has to enter the keys like:

appname.exe --key="public key" --key="secret key"

And if the user enters:
appname.exe --key="secret key" --key="public key"

How do you know which is the right one?

The best solution would be to enforce to specify public and secret params:
appname.exe public="public key" secret="secret key"


The last point also applies to my previous post. This way you will avoid some errors for your users.


Best Regards,
Ovanes


On 11/2/07, Edwin Savarimuthu <zerobook@gmail.com> wrote:
You can use something like this as well.

std::vector<std::string>  key_pair;
("secert", boost::program_options::value< std::vector<std::string>
>(&key_pair), "creates the share secret key");

Then you can do you error checks ...

if ( key_pair.size() == 2 )
{
  // Do your processing here
} else
{
  // error
}

This example uses string vector. I guess std::vector<BigInteger>
should also work for you.


Thanks,
Edwin




On 10/31/07, Ovanes Markarian <om_boost@keywallet.com> wrote:
> One more addition:
>
>     boost::tuple<BigInteger, BigInteger> key_pair;
>
> This will not parse your key. You need to do it manually. So your param
> should be std::string. And than you can tokenize you string. Or you define 2
> separate params and let program_options parse them into Integers for you.
> But I am unsure if this is supported. Probably yes. I am 100% sure program
> options will not tokenize one param for you. May be only if your key_pair
> supports construction from a space separted string.
>
>
> Regards,
> Ovanes
>
>
> On 10/31/07, Ovanes Markarian <om_boost@keywallet.com > wrote:
> >
> > Hi!
> >
> >
> >
> > On 10/31/07, chun ping wang <cablepuff@gmail.com> wrote:
> > >
> > > HI how would I use program options to accept multiple input.
> > >
> > > The thing compiles but when I do DiffieHellman.exe --secert 817 697
> > >
> > > I get this error.
> > > C:\CPW\cs_classes>DiffieHellmanEncrypt --secert 817 697
> > > terminate called after throwing an instance of
> > > 'boost::program_options::invalid_
> > > option_value'
> > >   what():  in option 'secert': invalid option value '817'
> > >
> > > This application has requested the Runtime to terminate it in an unusual
> > > way.
> > > Please contact the application's support team for more information.
> > >
> > >
> > >
> > the option is in your case:
> >
> > --secert="817 697"
> >
> > Regards,
> > Ovanes
>
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users