请各位大神帮我把一组字符分割开
我想把TOOL_NUM 用 str_split 分割开,不知怎么写
#include <stdio.h> #include <string.h> int main() { char tmp[100]= {'\0'}; char* t="T/TOOL_NUM/ MO6"; char* subt="/TOOL_NUM/"; char* _subt="02"; char* newt=strstr(t,subt); if(newt==NULL) { printf("查无此人!\n"); return 0; } else { int len1=((int)(newt)-(int)(t)); int len2=strlen(subt); int len3=strlen(t)-len1-len2; int len4=strlen(_subt); if(len4<=len2) { strncpy(tmp,t,len1); strncpy(tmp+len1,_subt,len4); strncpy(tmp+len1+len4,newt+len2,len3); printf("%s\n",tmp); } else { printf("子字符串超长!\n"); return 0; } } return 0; }