Well this doesn't make any sense either, the Preprocessor works before the Real Compilation, so Checking if a file exists while Compiling 1. Doesn't make any sense, because lets say that the program is compiled, than you got a handle as a constant in your program. Even if you change your file, or restart your pc, it will have the same handle, it just can't work
2. It doesn't work, because preprocessing is done before the Compilation, using C++ code in this statements just can't work well because the preprocessor doesnt work with C++ commands.
here a little example, try this little program:
Code:
#include <iostream>
#define FILENAME "/data.dat"
#define EXIST (fopen(FILENAME,"r") == NULL)?"true":"false" //Exist or not
int main()
{
std::cout << EXIST;
return 0;
}
the result is 1%