Menu

#25 Passing an empty string using options with follow()

open
nobody
None
5
2012-10-02
2012-06-29
tesanbei
No

When using the 'follow()' function with a std::string :

std::string my_str( "default value" );
my_str = cl.follow( my_str.c_str(), "-A" );

Two related problems:
-When the argument is a string starting with the '-' character, it is (logically) considered as an option rather than a string. The workaround is done by double quoting the string, i.e.:
my_app -A "-abc"
-But then, suppose I want to pass an empty string (because inside there is a default one, and I want to make it empty), then the following should work:
my_app -A ""
alas, it doesnt...
Is there an easy solution ?

BTW, a suggestion: maybe another follow() function could be added with a std string as argument (to remove the need for .c_str() ) ?

And thanks for this great lib !

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB