Is there a way to globally search for a file name + .exe or whatever, and then get it's directory. That means, let's say i have a file called "food.txt" in my deep C drive. I want to get it's directory, no matter where i put it in my pc by just typing it's name + the .txt.
Isn't there a like a tag or something for "global directory". I mean like "\global\food.txt"? Thank you!
So the thing that i'm trying to do is: When I type an existing file name with the .txt, i want to open this file, no matter where in my pc it is located at. Also i won't have two duplicates with the same name, don't worry :D
Code:
void open_program(string target_name) {
cout << "Opening..." << endl;
string final_directory = target_name;
ShellExecuteA(NULL, "open", final_directory.c_str(), NULL, NULL, SW_SHOWNORMAL);
cout << final_directory;
}