STATUS del_space(char* v_p_Str)
{
int len;
char* pBkup = NULL;
char* pSrcStr = NULL;
char* pDesStr = NULL;
char* pEnd = NULL;
char chFind = ' ';
if(NULL == v_p_Str)
{
return ERROR;
}
len = strlen(v_p_Str);
if(NULL == (pSrcStr = (char*)malloc(len + 1)))
{
return ERROR;
}
strcpy(pSrcStr, v_p_Str);
pBkup = pSrcStr;
pDesStr = pSrcStr;
pEnd = pSrcStr + len;
while(pSrcStr < pEnd)
{
if(chFind != *pSrcStr)
{
*pDesStr = *pSrcStr;
pDesStr++;
}
pSrcStr++;
}
*pDesStr = '\0';
strcpy(v_p_Str, pBkup);
free(pBkup);
return OK;
}