65,210
社区成员
发帖
与我相关
我的任务
分享
char *fullPath= "c:\\dd\\c.exe";
void fun(LPSTR fullPath, LPSTR fileName)
{
//LPSTR fileName[255];//删掉这行
char *buff = strrchr(full, '\\');// 找到路径名最后的反斜杠.
if ( buff )
strcpy(fileName, ++buff);// 找到,则取得文件名(相对路径,注意加1跳过反斜杠)
else
strcpy(fileName, fullPath);// 没找到,说明本来就是相对路径,直接cpy
}char *fullPath= "c:\\dd\\c.exe";
void fun(LPSTR fullPath, LPSTR fileName)
{
LPSTR fileName[255];
char *buff = strrchr(full, '\\');
if ( buff )
strcpy(fileName, ++buff);// 取得文件名(相对路径)
else
strcpy(fileName, fullPath);// 如果本来就是相对路径,直接cpy
}