X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=examples%2Fz.cpp;h=5f793c40cbdf08b68ac0316857ff8718856683da;hp=54f0eb7d336249c010ccb5911103f8bb88b7ee4a;hb=HEAD;hpb=8ed14b63ab6249e9fc2a3a691cf8ffbf49166deb diff --git a/examples/z.cpp b/examples/z.cpp index 54f0eb7..5f793c4 100644 --- a/examples/z.cpp +++ b/examples/z.cpp @@ -24,15 +24,16 @@ public: }; Z::Z(int argc, char **argv): - input_file(0) + input_file(nullptr) { + string input_fn; GetOpt getopt; getopt.add_option('d', "decompress", decompress, GetOpt::NO_ARG); + getopt.add_argument("filename", input_fn, GetOpt::OPTIONAL_ARG); getopt(argc, argv); - const vector &args = getopt.get_args(); - if(!args.empty()) - input_file = new IO::File(args[0]); + if(!input_fn.empty()) + input_file = new IO::File(input_fn); input = (input_file ? static_cast(input_file) : static_cast(&IO::cin)); output = &IO::cout;