C语言试题 编写一个获取文件路径的函数

[复制链接]
查看11 | 回复1 | 2017-12-16 13:00:31 | 显示全部楼层 |阅读模式
#includemain(){char str[80]="d:\\files\\dataFiles\\data\\avatar.bmp";
// 单斜杠处填双斜杠int L,i;L = strlen(str);for (i=L-1;i>=0;i--) if (str == '\\') { str ='\0'; break;};
// 去掉文件名就是路径printf("Path= %s",str);return 0; }-----------写成函数和调用:#include void fun(char *str){int L,i...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行