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

Started by
2 comments, last by FFMG 13 years, 11 months ago
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
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.
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
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

This topic is closed to new replies.

Advertisement