Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
得到一个路径的纯文件名 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


char *GetFileName(char *p) //得到一个路径的纯文件名
{
    int x = strlen(p);
    char ch = '\\';
    char *q = strrchr(p,ch);
    return q + 1;
}

https://www.jb51.net/article/77353.htm

有删改,原函数的效果:

传入"C:\test\a.exe"

输出"\a.exe"


在返回值处对地址加了1,避免了返回的字符串中多出'\'




返回首页


Copyright (C) 2018-2024 huidong