- memcached_return_t rc;
- auto file = opt.argof("file");
- if (file && *file) {
- std::ofstream stream{file, std::ios::binary};
- rc = memcat(opt, &memc, key, stream);
- } else {
- rc = memcat(opt, &memc, key, std::cout);
- }
- if (MEMCACHED_SUCCESS != rc) {
- exit_code = EXIT_FAILURE;
+ std::ofstream fstream{};
+ std::ostream *ostream = check_ostream(opt, opt.argof("file"), fstream);