/**
函数名:zip_space
功能 :压缩空格的函数
参数 :
s 源字符串
返回值:
0 成功
**/
int zip_space(char *s){
int i,j;
int len;
if(s==NULL || strlen(s)==)
{
return -;
} len=strlen(s); i=j=;
while(s[i]!='\0'){
if(s[i]!=' '){
if(i!=j){
s[j]=s[i];
}
i++;j++;
}else{
i++;
}
}
while(j<i){
s[j]='\0';
j++;
}
return();
}
/*************
****************/
int zip_0a09(char *s, int begin)
{
int len=strlen(s);
int i,j;
i=j=begin;
while(s[i]!='\0'){
if(s[i]!=0x09 && s[i]!=0x0a){
if(i!=j){
s[j]=s[i];
}
i++;j++;
}else{
i++;
}
}
if(j<i){
s[j]='\0';
}
return(j);
} /****asc->bcd***/
int iAscToBcd(char *pcASC,char *pcBCD,int iLength){
int i;
for(i=;i<iLength/;i++){
unsigned char ch1,ch2;
ch1=(unsigned char)pcASC[i*];
ch2=(unsigned char)pcASC[i*+];
if(ch1>='a' && ch1<='f')
ch1=ch1-'a'+0xa;
else if(ch1>='A' && ch1<='F')
ch1=ch1-'A'+0xa;
else
ch1=ch1-'';
if(ch2>='a' && ch2<='f')
ch2=ch2-'a'+0xa;
else if(ch2>='A' && ch2<='F')
ch2=ch2-'A'+0xa;
else
ch2=ch2-'';
pcBCD[i]=(ch1<<)|ch2;
}
return();
} /****bcd->asc***/
int iBcdToAsc(char *pcBCD,char *pcASC,int iLength){
int i;
for(i=;i<iLength;i++){
unsigned char ch;
ch=(unsigned char)pcBCD[i];
ch=ch>>;
if(ch>=){
pcASC[*i]=ch-+'A';
}else{
pcASC[*i]=ch+'';
}
ch=(unsigned char)pcBCD[i];
ch=ch &0x0f;
if(ch>=){
pcASC[*i+]=ch-+'A';
}else{
pcASC[*i+]=ch+'';
}
}
return();
}