Boost options - get application name

Is there an easy way to get the application name using Boost (maybe with boost::program_options?)

Everything will be like this:

Having argv[0] = "c:\foo\bar\appname.exe"

I want to have var1 = "appname"

+5
source share
1 answer

You can use boost :: filesystem to extract the name from the path. it will look something like this:

#include <boost/filesystem.hpp>

boost::filesystem::path p = argv[0];
std::string var1 = p.stem().string();
+10
source

All Articles