//求去掉空格
int trimSpaceStr2( char *p, char *buf2)
int ret = 0;
int ncount = 0;
int i, j;
i = 0;
j = strlen(p) -1;
while (isspace(p[i]) && p[i] != '\0')
{
i++;
}
while (isspace(p[j]) && j>0 )
{
j--;
}
ncount = j - i + 1;
//
strncpy(buf2, p+i, ncount);
buf2[ncount] = '\0';
return ret;
}
//测试用例
void main()
{
char buf[] = " abcd ";
char buf2[1024] = {0};
//memset(buf2, 0, sizeof(buf2));
printf("buf2:%s \n", buf2);
}