|
Boost Users : |
Subject: Re: [Boost-users] [Program Options] Input information as std::string
From: Vladimir Prus (ghost_at_[hidden])
Date: 2012-07-14 11:13:31
On 14.07.2012 16:56, Nicholas Yue wrote:
> Hi,
>
> I have a situation where I would like to parse the command line options not as (int argc, char **argv)
>
> template<typename charT>
> basic_parsed_options< charT >
> parse_command_line(int argc, const charT *const argv,
> const options_description &, int style = 0,
> function1< std::pair< std::string, std::string >, const std::string & > ext = ext_parser());
>
>
> but as a std::string.
>
> The std::string is the equivalent of the command line but obtain either from reading some file or cut and paste.
>
> E.g. my input string would be something like "myprog 817382 --lod="lod.cfg" --radius=3.0"
>
> With such string as the above, I'd like to know how I should pass it to boost::program_options
Hi Nicolas,
I am afraid you'd have to tokenize this string according to the rules you want. For windows, there's parse_winmain
function that does that, but for Linux, there's no such function because:
- On Linux, program entry point always has array of chars
- Implementing tokenization for linux might be even trickier than for windows.
Sorry,
Volodya
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