字符串分割处理,strstr函数应用
来源:互联网 发布:淘宝自动秒杀软件 编辑:程序博客网 时间:2024/04/28 06:37
任务:把"123.wmv\n456.wmv\n789.wmv\nmv.wmv"这串字符串分割成一系列*.wmv输出
#include <stdio.h>#include <string.h>int main(){ char *List[100]; char spath[60]="123.wmv\n456.wmv\n789.wmv\nmv.wmv"; char *ps = spath; char *needle="\n"; char* buf = strstr( ps, needle); int i = 0; char **pList; pList=List; while( buf != '\0' ) { buf[0]='\0'; List[i] = (char*)malloc(4); strcpy(List[i],ps); ps = buf + strlen(needle); buf = strstr( ps, needle); printf("%s\n",*(pList+i)); i++; } List[i] = (char*)malloc(4); strcpy(List[i],ps); printf("%s\n",*(pList+i));}
output:
123.wmv456.wmv789.wmvmv.wmvProcess returned 0 (0x0) execution time : 0.094 sPress any key to continue.
- 字符串分割处理,strstr函数应用
- strstr函数[字符串处理]
- strstr分割字符串
- 字符串处理函数(四):strstr
- 字符串处理函数学习整理之一 strstr()
- 用strstr进行字符串分割
- strstr--字符串处理
- 字符串高级处理函数(Strcmp,Substr,Strstr,partition)
- [C/C++] 字符串处理函数 strstr 与 strncpy
- 字符串处理函数strchr和strstr的实现
- c,c++中字符串处理函数strtok,strstr,strchr,strsub
- NBUT 1670 字符串(strstr函数的处理)
- 字符串函数strstr
- 字符串函数strstr
- strstr字符串查找函数
- 搜索字符串strstr()函数
- 湖南大学 oj LOL 字符处理函数 strstr 的应用
- PHP字符串函数教程:PHP字符串分割函数处理
- UML图中的符号说明
- 表cache/nocache
- 14.2 以并行方式运行的图形效果
- 创建android下repo的mirror镜像然后内网访问
- 李彦宏谈创业:不被关注是种幸福
- 字符串分割处理,strstr函数应用
- Dev Eject检测锁住USB驱动器的文件
- “黑客”令奥巴马“被死亡”
- epoll精髓
- 修改用Activity伪装的Dialog弹出位置
- 微软必应主管:传统搜索即将消亡
- 12-3今天论文进展总结
- HDU 1021 Fibonacci Again
- 黑马程序员-类加载器