• Advertisement
Sign in to follow this  

boost::program_options::value... UNICODE?

This topic is 2819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I would like to pass a path as one of my command line argument. But it is not impossible that some of my users will have some unicode characters in the path. But I don't see to be able to add the option, add_options( "path", boost::program_options::value<const wchar_t*>(), "The path" ) Am I missing something? Is it not possible to pass unicode characters via command line, (I am programming a windows App)? Many thanks FFMG

Share this post


Link to post
Share on other sites
Advertisement
Unocide Support.

Also, use wstring, I don't think char arrays work well with these libraries, they definitely make memory management difficult.

And to parse command line arguments, it's also necessary to use proper main() signature, and build the project with unicode support.

Share this post


Link to post
Share on other sites
Quote:
Original post by Antheus
Unocide Support.


I have the right settings for my compiler, (VS2008).

And, according to the doc, it says, "For example, the parse_command_line function has an overload which takes wchar_t strings, instead of ordinary char.", so it should work as far as I understand it.

Quote:

Also, use wstring, I don't think char arrays work well with these libraries, they definitely make memory management difficult.


Hum, add_options( "path", boost::program_options::value<std::wstring>(), "The path" )
Doesn't work either ...

Quote:

And to parse command line arguments, it's also necessary to use proper main() signature, and build the project with unicode support.


Yet, I have that.
I must be missing something else.

FFMG

Share this post


Link to post
Share on other sites
Quote:
Original post by FFMG
Quote:

And to parse command line arguments, it's also necessary to use proper main() signature, and build the project with unicode support.


Yet, I have that.
I must be missing something else.


What I was missing was the definition, it should be

boost::program_options::wvalue<std::wstring>() instead of boost::program_options::value<std::wstring>()

FFMG

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement