char*data和char data[]的区别要注意:
#include<stdio.h>
#include<string.h>
#pragma warning(disable:4996)
/*
*/
void ReplaceSpace(char* data, const char* xbegin, const char* xend)
{
char* sbein;
char* send;
int ilen, i;
sbein = strstr(data, xbegin);
send = strstr(data, xend);
printf("%c", sbein[0]);
sbein[0] = 'a';
printf("%c", sbein[0]);
printf("%c", *send);
if ((sbein != NULL) && (send != NULL))
{
send = send + strlen(xend);
ilen = strlen(sbein) - strlen(send);
for (i = 0; i < ilen; i++)
{
sbein[i] = ' ';
printf("newdata:%s\n", data);
}
}
}
int main(){
char data[] = "<name>hello world</name>";
printf("olddata:%s\n", data);
ReplaceSpace(data, "<name>", "</name>");
printf("newdata:%s\n",data);
system("pause");
}