The only robust way to check whether a file exists is to try to open it, and see if it succeeds or fails.
Any other method is a potential race condition. For example, GetFileAttributes
can tell you if a file existed when you called the function, but that's not the same as whether it exists when you try to open it. It might have been deleted (or created) in the meantime.