#include <windows.h>
void main()
{
if (-1!=GetFileAttributes("D:\\MyProjects\\临时程序"))
printf("文件夹存在\n");
if (-1!=GetFileAttributes("D:\\MyProjects\\临时程序\\Desktop.ini"))
printf("文件存在\n");
if (true==(bool)PathIsDirectory("D:\\MyProjects\\临时程序"))
printf("测试PathIsDirectory 文件夹存在\n");
else
printf("测试PathIsDirectory 文件夹不存在\n");
if (true==(bool)PathFileExists("D:\\MyProjects\\临时程序\\"))
printf("PathFileExists 文件夹存在\n");
else
printf("PathFileExists 文件夹不存在\n");
if (true==(bool)PathFileExists("D:\\MyfProjects\\临时程序\\Desktop.ini"))
printf("PathFileExists 文件存在\n");
else
printf("PathFileExists 文件不存在\n");
}
太有用了,转自http://www.cnblogs.com/lujin49/p/5034797.html