如何判定文件或文件夹是否存在?

API函数:PathFileExists

就能完成此功能.

#include <windows.h>
#include <stdio.h>
#include <tlhelp32.h>
#include <Shlwapi.h>
#pragma comment(lib,"shlwapi.lib")

 

 

//测试代码

void Test(void)

{

 if(PathFileExists("c:\\inject.txt"))

{

             AfxMessageBox("Exist!!");

}

}

 

你可能感兴趣的:(职场,休闲,判定文件存在)