It will not work, infile != NULL allways.
There are a lot of ways to do it.
1)
#include <windows.h>
if(GetFileAttributes( PathName) == -1 ) {
//File not exists or no access - what is?
unsigned long dwerr = GetLastError();
if(dwerr == ERROR_SUCCESS || dwerr == ERROR_FILE_NOT_FOUND || dwerr == ERROR_PATH_NOT_FOUND || dwerr == ERROR_BAD_NETPATH) {
//File really not exists!
}
else {
//No access
}
}
2)
#include <io.h>
...
if(access(PathName, 0) == -1) {
//File not exists
}
3)
#include <stdio.h>
....
FILE * fl = fopen(PathName,"rb"

;
if ( fl == NULL) {
//File not exists or no read access
}
else
fclose( fl); //Close handle