【MSDN】由文件路径获得文件名--PathFindFileName()函数

今天偶然翻看MFC源代码,发现了一个函数PathFindFileName(),这个函数的作用就是用来获取路径中的文件名的。下面是MSDN的文档。
LPTSTR PathFindFileName(      LPCTSTR pPath      );  

Searches a path for a file name.

  • Returns a pointer to the address of the string if successful, or a pointer to the beginning of the path otherwise.
pPath
Address of the file name for which to search.


在MSDN中还发现了以下函数:

由文件路径判断文件是否存在的函数
BOOL PathFileExists(      LPCTSTR lpszPath      );  

Determines if a file exists.

  • Returns TRUE if the file exists, or FALSE otherwise.
lpszPath
Address of the file to verify.

This function will test for the validity of the file and path.

由文件路径获得文件扩展名的函数

LPTSTR PathFindExtension(      LPCTSTR pPath      );  

Searches a path for an extension.

  • Returns the address of the "." preceding the extension within pPath if an extension is found, or the address of the trailing NULL character otherwise.
pPath
Address of the path that contains the extension for which to search.

由文件路径返回下一层路径的函数

LPTSTR PathFindNextComponent(      LPCTSTR pszPath      );  

Parses a path for the next path component. Paths are delimited by backslashes or by the NULL at the end of the path.

  • Returns the address of the start of the next path component if successful, or NULL otherwise.
pszPath
Address of the path to search.

在给定的目录下搜索指定文件的函数

BOOL PathFindOnPath(      LPTSTR    pszFile,      LPCTSTR * ppszOtherDirs      );  

Finds a file within a given path.

  • Returns TRUE if successful, or FALSE otherwise.
pszFile
Address of the file name for which to search.
ppszOtherDirs

Address of the path to be searched.



转自:http://blog.163.com/lvan100@yeah/blog/static/681172142010118114235316/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值