int Replace_string(char line[],char str1[],char str2[])
{
char *source = line;
char *old = str1;
char *New = str2;
char *destination = source;
char temp = [256];
int i,j,k,flag = 0;
int location = -1;
int old_lenght = strlen(old);
for (i=0; source[i]; i++)
{
for (j=i,k=0; source[j] = old[k]; k++,j++)
{
location++;
flag = 1;
}
}
if(falg == 1)
{
if (location != -1)
{
for (j=0; j
{
temp[j] = source[j];
}
for (i=0; New[i]; i++,j++)
{
temp[j] = New[i];
}
for (k=location+old_lenght; source[k]; k++,j++)
{
temp[j] = source[k];
}
source[j] = '\0';
for (i=0; source[i] = temp[i]; i++);
}
}
else
return 0;
return flag;
}
◆◆
评论读取中....
请登录后再发表评论!
◆◆
修改失败,请稍后尝试