帮忙看看这两个函数
unsigned char Encoding(unsigned short unicode,unsigned char *charLength,unsigned char
*arrOut) {
U8 flag = 1; U8 index = 0;
if(arrOut != 0) { if( unicode < 256 ) { arrOut[index++] = *((U8*)(&unicode)); arrOut[index] = 0; } else { arrOut[index++] = *((U8*)(&unicode)); arrOut[index] = *(((U8*)(&unicode)) + 1);
} *charLength = 2; } else { flag = 0 }
return flag; }
unsigned short AskToUni(char *pOutBuffer, char *pInBuffer ) { short count = -1; U8 charLen = 0; U8 arrOut[2];
while( *pInBuffer != '\0') { Encoding((U16)*pInBuffer,&charLen,arrOut);
pOutBuffer[++count] = arrOut[0]; pOutBuffer[++count] = arrOut[1]; pInBuffer++;
}
pOutBuffer[++count] = '\0'; pOutBuffer[++count] = '\0'; return count + 1; }