Is there a simple way to get the application name using Boost (maybe with boost::program_options
?)
The thing will be like this:
Having argv[0] = "c:\foo\bar\appname.exe"
I want to have var1 = "appname"
You can use boost::filesystem to extract the name from the path. that would look something like this:
#include <boost/filesystem.hpp>
boost::filesystem::path p = argv[0];
std::string var1 = p.stem().string();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With