判断文件和文件夹存在是几种方法
来源:互联网 发布:淘宝家具客服话术 编辑:程序博客网 时间:2024/05/16 11:36
一、判断文件夹是否存在:
1. _access, _waccess
http://msdn.microsoft.com/zh-tw/library/vstudio/1w06ktdy(v=vs.90).aspx
2. CFileFind 遍历目录判断是否存在
http://msdn.microsoft.com/en-US/library/scx99850(v=vs.80).aspx
3. PathIsDirectory
http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx
二、判断文件是否存在:
1. _access, _waccess
http://msdn.microsoft.com/zh-tw/library/vstudio/1w06ktdy(v=vs.90).aspx
2. CFileFind 遍历目录判断是否存在
http://msdn.microsoft.com/en-US/library/scx99850(v=vs.80).aspx
3. 使用CreateFile函数,函数原型为:
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORDdwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,// how to create
DWORD dwFlagsAndAttributes,// file attributes
HANDLE hTemplateFile// handle to file with attributes to
// copy
);LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORDdwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,// how to create
DWORD dwFlagsAndAttributes,// file attributes
HANDLE hTemplateFile// handle to file with attributes to
// copy
);4. 使用FindFirstFile函数,函数原型为:
HANDLE FindFirstFile(
LPCTSTR lpFileName,// pointer to name of file to search for
LPWIN32_FIND_DATA lpFindFileData
// pointer to returned information
);5. 使用GetFileAttributes函数,函数原型如下:
DWORD GetFileAttributes(
LPCTSTR lpFileName// pointer to the name of a file or directory
);- 6. 使用Shell Lightweight Utility APIs函数PathFileExists()专门判断文件和目录时否存在的函数文件名可读性比较强还可以判断目录是否存在Header: Declared in Shlwapi.h
Import Library: Shlwapi.lib
- 判断文件和文件夹存在是几种方法
- Python判断文件和文件夹是否存在的方法
- Python判断文件和文件夹是否存在的方法
- Python判断文件和文件夹是否存在的方法
- Python判断--文件和文件夹--是否存在的方法
- Python判断文件和文件夹是否存在的方法
- Python判断文件和文件夹是否存在的方法
- Python判断文件和文件夹是否存在的方法
- python 判断文件和文件夹是否存在的方法
- python判断文件和文件夹是否存在
- Python 判断文件和文件夹是否存在
- Java判断是否存在文件和文件夹
- python判断文件和文件夹是否存在
- Python 判断文件和文件夹是否存在
- Python判断文件和文件夹是否存在
- C#怎样判断文件是否存在和文件夹是否存在
- python判断文件和文件夹是否存在、创建文件夹
- python判断文件和文件夹是否存在、创建文件夹
- 【C语言的学习】第八回合:函数大集合
- Android客户端向Python服务器以POST方式传输数据
- C# 序列化 反序列化
- strcspn函数
- 通用SQL分页存储过程
- 判断文件和文件夹存在是几种方法
- ios 实现地图的定位,查询,自定义大头针
- SQL Server 触发器
- 1052. Linked List Sorting (25)
- linux中c语言和php语言通信代码UDP&TCP
- 【Java程序运行超时后退出或进行其他操作的实现】
- 【每天一个Linux命令】18. 设置指令别名命令alias
- 一列保存多个ID(将多个用逗号、特殊符号 隔开的ID转换成用逗号隔开的名称)
- Linux TCP server系列(6)-select模式下的多线程server