If you were running windows you could use some system("IF EXIST ..."); type statements to see if a file exists, like:
FIRST-Include cstdlib and iostream:
cpp
#include <cstdlib>;
#include <iostream>
SECOND-Create and environment variable if not already defined:
cpp
bool variableexist;
char * varexist = getenv("APPINSTALLED");
if (varexist) variableexist=true;
else variableexist=false;
THIRD: If your variable does not exist create one:
cpp
if (variableexist==false) putenv("APPINSTALLED");
FOURTH: Set the environment variable with a system call:
cpp
system("IF NOT EXIST \"C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE\" (SET APPINSTALLED=1) ELSE (SET APPINSTALLED=0)");
FIFTH: Get the new value APPINSTALLED, and create a bool for that and set it:
cpp
char * APPINSTALLED=getenv("APPINSTALLED");
bool application_install;
if (APPINSTALLED=='1') application_install=true;
else application_install=false;
FINALLY: Output:
cpp
if (application_install==true) {
cout << "Microsoft Office Word 11 is installed on this system.";
}
else {
cout << "You must install Microsoft Office Word 11 for this program to work. I do not know why.";
}
cout << endl << "Press any key to exit. ";
system("pause>nul");