I'm going through the process of learning c++, so I'm making a few programs/tools to do certain easy operations on the computer. In this example, I'm creating a program that will locate browsers on the computer (it will be used to clear browser cookies etc.). There is probably more advanced ways to do this more effieciently, but I'm trying to keep this as simple as possible at the moment.
So far, I'm trying to find out if the directory "C:\Program Files (x86)\Google\Chrome" exist. I get the address to the program files directory by using getenv ("Program Files (x86)"
, but how do I add the rest of the address after?
I can't use the + operator for concatenation, since the variable is const char * (bool PathIsDirectory() requires const char * as parameter).
std::cout << "Searching for browsers..." << std::endl;
const char *chromePath;
chromePath = getenv ("ProgramFiles(x86)");
bool result = PathIsDirectory(chromePath);
if(result == true)
{
std::cout << "-- Google Chrome - FOUND" << std::endl;
}
else
{
std::cout << "-- Google Chrome - NOT FOUND" << std::endl;
}