问题描述
以下是我所面临的问题的快速回顾:
#include <iostream>
#include <cstring>
int main()
{
char path[100] = "home/user/cvs/test/VSCode/Test.dll";
char *pos = strrchr(path,'/');
if (pos != NULL)
{
*pos = '\0';
}
printf("%s",path);
}
我在路径名中找到最后一个“ /”,并且需要在最后一个“ /”之后打印所有内容,因此输出需要为:
Test.dll
但是,在我当前的代码中,输出为:
home/user/cvs/test/VSCode
基本上,我的代码在最后一个“ /”之前打印所有内容,但我需要在最后一个“ /”之后打印所有内容。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)