First, determine whether the folder exists:
1. Use CreateDirectory (".//filemanege", NULL), or create if the folder Filemanege does not exist.
2. Or if (_access (".//filemanege", 0) ==-1), indicates that Filemanege does not exist.
3. or bool Pathisdirectory (LPCTSTR Pszpath);
Second, determine whether the file exists:
1. Using if ((File=fopen (".//filemanege//f//f.dat", "RB")) ==null)
File=fopen (".//filemanege//f//f.dat", "ab+"); First judge whether there is no file, no words to create a new
2. Use if (_access (".//filemanege//f//f.dat", 0) ==-1) to indicate that the file does not exist.
function int _access (const char *path, int mode), can determine the Mode property of a file or folder
Mode=00;//existence only
Mode=02;//write permission
Mode=04;//read permission
Mode=06;//read and Write permission
Need to include header file <io.h>.
Transferred from: http://luzongping1986.blog.163.com/blog/static/788129152009379452504/
A/C + + determines if a file/folder exists