c++取出文件路径中的文件名

cpp 复制代码
void getFileName(const char* path, char* file_name)
{
    const char* lastSlash = strrchr(path, '\\');
    if (lastSlash != nullptr)
    {
        strcpy(file_name, lastSlash + 1);
    }
    else
    {
        strcpy(file_name, path);
    }
}
相关推荐
geovindu7 小时前
rust: Template Method Pattern
开发语言·后端·设计模式·rust·行为模式·模板方法模
小oo呆8 小时前
【学习心得】Python函数参数中的两个特殊分隔符
开发语言·python
x10n98 小时前
微软 VC++ 运行库合集VCRedistPack
开发语言·c++·microsoft·vc++运行库·dll报错
qz_Serene8 小时前
C++:string(底层,常用接口,具体题目,模拟实现)
开发语言·c++
NiceBlueChai8 小时前
Qt 跨线程传递多容器嵌套结构:一次 Release 实测
开发语言·qt
念何架构之路8 小时前
go-grpc逻辑架构图
开发语言·后端·golang
SEO_juper8 小时前
AI 爬虫 robots.txt 检查工具:你的站是不是把 AI 挡在门外了
开发语言·人工智能·爬虫·python·外贸独立站
木圭的AI时代指南8 小时前
实测 MiniMax M3.1 Flash:同一道 Three.js 大题,两个 agent 差出 4.6 倍
开发语言·javascript·ecmascript
星恒讯工业路由器8 小时前
工业路由器在中小 IoT 场景的选型与适配实践:从标准品到定制化的技术路径
开发语言·网络·物联网·php·工业路由器选型·工业网关odm·链路冗余切换