本文共 600 字,大约阅读时间需要 2 分钟。
#include#include #include #include int replace_sub_str(const char *str,const char *substr,char *repstr,char *result){ const char *p,*q,*re,*temp1; //char *q; char *temp,*t; int n,count = 0,m,i; p = str; q = substr; re = repstr; n = strlen(q); m = strlen(re); temp = (char*)malloc(n+1); memset(temp,0x00,n+1);t = result; while(*p) { memcpy(temp,p,n); if(strcmp(temp,q)==0) { count++; memset(temp,0x00,n+1); p = p + n; temp1 = repstr; for(i = 0;i
转载地址:http://jlkhj.baihongyu.com/