You simply add an condition, that checks for the existence of the file. You can do that by trying to open the file using standard C/C++ library and checking if it fails, like this:
Version that uses new C++ object oriented libraries.
Hidden Content
You must
[To see links please register here]
or
[To see links please register here]
to view this content.
Version that uses C-like libraries, but it's still C++, but can be converted to standard C easily (swap <cstdlib> for <stdlib.h> and <cstdio> for <stdio.h> and remove the using namespace declaration)
Hidden Content
You must
[To see links please register here]
or
[To see links please register here]
to view this content.
There are also functions (in various libraries and APIs) that are specifically designed for checking if file exists, however these are not part of standard C/C++ library and thus might not work everywhere and are often operating system specific (though you're obviously running on Windows).
Also, it's discouraged to use absolute paths (rather find the path to the specific application (or game in your case) for example by retrieving data from the registry), because if the files are located elsewhere, your code won't work.