Commented out own options control and added boost options control

This commit is contained in:
x-00010 2021-04-26 09:11:08 +01:00
parent acafa69663
commit f96c44f931
1 changed files with 51 additions and 2 deletions

View File

@ -1,9 +1,58 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <boost/program_options.hpp>
namespace po = boost::program_options;
void parseargs(int argc, char* argv[])
{
po::options_description desc("Allowed options");
desc.add_options()
("help", "Print this message")
("input,i", "Specify an input file")
("ih", "Input data is in hex")
("output,o", "Specify an output file")
("oh", "Output data in hex")
;
po::positional_options_description p;
p.add("input", -1);
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if (vm.count("help"))
{
std::cout << desc << std::endl;
}
if (vm.count("input"))
{
std::cout << "input works";
}
/*if (vm.count(""))
{
}
if (vm.count(""))
{
}
if (vm.count(""))
{
}*/
}
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
std::fstream fInput; parseargs(argc, argv);
/*std::fstream fInput;
fInput.open(argv[1], std::ios::in); fInput.open(argv[1], std::ios::in);
if (!fInput) if (!fInput)
{ {
@ -20,5 +69,5 @@ int main(int argc, char* argv[])
std::cout << std::endl; std::cout << std::endl;
fInput.close(); fInput.close();
} }
return 0; return 0;*/
} }