get "Program Files" directory
I'm trying to write a function that finds the default Program Files directory. I've created one that write the directory to a file, then it gets opened for reading, but this is extremely unproductive and I was wondering if there is a way around this:
I'm trying to avoid the use of the system() command...
ifstream f ("pgmfiles.txt");
if ( !f.is_open() )
cout << "ERROR! Unable to locate program files directory!" << endl << "Press a key to quit.";
getline(f, pgmfiles, '\n');
Any help will be greatly appreciated.