Reputation: 30915
i try to find out way to get exe file name of the application using cross platform POCO c++ lib .
tryed with :
char* FileName ;
FileName = const_cast<char*>(Application::name());
but all i get in the FileName char * is "Application" what do i do wrong here ?
Upvotes: 0
Views: 1092
Reputation: 36402
The documentation says:
application.name: the file name of the application executable
And there's a name()
method:
https://github.com/pocoproject/poco/blob/develop/Util/src/Application.cpp#L179 :
const char* Application::name() const
{
return "Application";
}
Which I find a bit confusing. However, the docs are right:
The right way to deal with this is getting the config (Application::config()
) and retrieving the data from therein.
Still, πάντα ῥεῖ's comment on your original question is right: No need to use a "portable" library for something that comes with the language. The main
function's argv[0]
is defined to contain the executable name.
Upvotes: 3