PathFindExtension
来源:互联网 发布:樱井知香番号全集 编辑:程序博客网 时间:2024/06/16 13:46
从一个文件路径获取一个文件名后缀。
函数声明:
PTSTR PathFindExtension( _In_ PTSTR pszPath);
参数:
PTSTR pszPath
可存储文件的整个完整路径或者一个文件名(有文件后缀名),但最大长度不超过 MAX_PATH ,以null字符结束。
返回:
若找到后缀名,则返回一个指针,该指针是以点(.)为前缀的扩展名的地址;反之,返回null字符的地址。
头文件:
shlwapi.h
库文件:
shlwapi.lib
其中PathFindExtensionW为unicode字符集函数,PathFindExtensionA为ANSI字符集函数。
实例:
#include <stdio.h>#include <Shlwapi.h>#pragma comment(lib, "shlwapi.lib") int main(){char path[] = "C:\\Windows\\System32/notepad.exe";LPCSTR name;LPCSTR ext;/* will output "notepad.exe" */name = PathFindFileName(path);ext= PathFindExtension(name);printf("%s\n", name);printf("%s\n", ext);getchar();return 0;}
输出.exe:
阅读全文
0 0
- PathFindExtension
- 160. Intersection of Two Linked Lists
- 如何通过adb command去控制MTKLogger 开关,设定log路径等等
- PinPoint使用教程
- 透透彻彻IoC(你没有理由不懂!)
- CSS3自定义滚动条样式 -webkit-scrollbar
- PathFindExtension
- Win7/Win10安装AutoCAD+CASS
- leetcode 101. Symmetric Tree
- 剑指offer----替换
- 勤智观点:云运维概念与趋势浅读
- AlertDialog cancel() 销毁窗口流程解析
- tarjan算法
- LeetCode 153. Find Minimum in Rotated Sorted Array
- 理解硬盘