mtsuyugu #7627(2008/09/11 10:58 GMT) [ C++ ] Rating0/0=0.00
gflags を使ってみました。 -oq や -d1 のような連続して指定する形式には対応していません。
see: google-gflags
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#include <iostream> #include <google/gflags.h> DEFINE_bool( o, false, "(required)" ); DEFINE_bool( q, false, "quote(optional)" ); DEFINE_int32( d, 0, "debug(required) {0|1|2}" ); using namespace std; int main ( int argc, char *argv[] ){ google::SetUsageMessage("-o [-q] [-d{0|1|2}] str1 [str2 ...] "); google::ParseCommandLineFlags(&argc, &argv, true); if( !FLAGS_o || FLAGS_d < 0 || FLAGS_d > 2 || argc < 2 ){ google::ShowUsageWithFlags(argv[0]); return 1; } cout << "[option]" << endl << "o(output): " << (FLAGS_o ? "ON" : "OFF") << endl << "q(quote): " << (FLAGS_q ? "ON" : "OFF") << endl << "d(debug): " << FLAGS_d << endl << endl << "[parameter]" << endl << "given " << (argc-1) << endl; for( int i = 1; i < argc; i++ ){ cout << i << ": " << argv[i] << endl; } return 0; }
Rating0/0=0.00-0+
[ reply ]
mtsuyugu
#7627()
[
C++
]
Rating0/0=0.00
gflags を使ってみました。 -oq や -d1 のような連続して指定する形式には対応していません。
see: google-gflags
Rating0/0=0.00-0+
[ reply ]