PathFindFileName函数,由文件路径获得文件名

PathFindFileName函数的作用是返回路径中的文件名。

 

  1. PTSTR PathFindFileName(  
  2.     __in  PTSTR pPath  
  3. );  


 

 

pPath是指向文件路径字符串的指针,函数返回指向文件名的指针(如果找到的话),否则返回指向路径开头的指针。

PathFindFileName既支持Windows下的反斜杆,也支持Unix下的斜杠,还支持斜杆和反斜杠的混合,例如:

  1. /* 
  2.  * Author: Demon 
  3.  * Date: 2012/6/6 
  4.  * Website: http://demon.tw 
  5.  */  
  6. #include <stdio.h>  
  7. #include <Shlwapi.h>  
  8.   
  9. int main()  
  10. {  
  11.     char path[] = "C:\\Windows\\System32/notepad.exe";  
  12.     /* will output "notepad.exe" */  
  13.     printf("%s\n", PathFindFileName(path));  
  14.     return 0;  
  15. }  
更多

转自:http://blog.csdn.net/setflvet/article/details/8280137
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值