I am writing a little program to do some functions on some PC our company sells. The PC have a security feature that locks them down to prevent tampering. However, in order to do things, this feature can be temporary disabled. The program I am writing requires the PC to be "unlocked" prior to continuing. For our PCs running Windows 10 I have this sorted out and that part of my code works fine. However for our Windows 7 PCs I am having issues. The Windows 7 PCs had an old Security setup which really only altered the GroupPolicy folder by changing its name and ran gpudate. Well I am trying to see if the _GroupPolicy folder exist or not and that is where I am hitting a wall.
I posted a test code I using to see if I can get the right results so the code is not from the actual program but rather just to test the results. Regardless of how i set it up I get the same results of it running the if part rather than the else part even if the GroupPolicy folder has been renamed _GroupPolicy.
Under windows it should be _stat not stat. Why is there an extra backslash at the end of the path? Try remove it.
However, if you have access to a recent compiler (which supports c++17) you should consider using std::filesystem. With this it's easy to check whether the path exists. See: