4

Using Boost Program Options, how do you get the string equivalent of argv[0]?

4

1 回答 1

6

I don't think this is possible. This may be because the program name could also legally be used as an option name.

The command line parser code explicitly skips the relevant argv member:

template<class charT>
basic_command_line_parser<charT>::
basic_command_line_parser(int argc, charT* argv[])
: detail::cmdline(
    // Explicit template arguments are required by gcc 3.3.1 
    // (at least mingw version), and do no harm on other compilers.
    to_internal(detail::make_vector<charT, charT**>(argv+1, argv+argc+!argc)))
{}
于 2010-12-02T20:11:47.323 回答