T
Tophi
Unregistered / Unconfirmed
GUEST, unregistred user!
谁把这段代码翻译成DELPHI的?
只要功能
谢谢,50分
static char _UniCode[127][768] = {......}
int __Ansi2Unicode(lpszAnsi,lpUnicode)
char *lpszAnsi;
unsigned short *lpUnicode;
{
unsigned char *p = (unsigned char *)lpszAnsi, c;
unsigned short *t = lpUnicode;
unsigned int w;
size_t len;
int i, j;
char szTemp[5];
len = strlen(lpszAnsi);
while(*p){
if(*p < 0x81) *t++ = (unsigned short)(*p++);
else{
c = *(p+1);
if(c < 0x40) {
*t++ = (unsigned short)*p++;
*t++ = (unsigned short)*p++;
}
else{
i = *p - 0x81;
j = (c - 0x40) * 4;
strncpy(szTemp, &_UniCode[j], 4);
szTemp[4] = 0;
sscanf(szTemp, "%04X", &w);
*t++ = (unsigned short)w;
p += 2;
}
}
}
*t = 0;
len = (t - lpUnicode);
return len;
}
只要功能
谢谢,50分
static char _UniCode[127][768] = {......}
int __Ansi2Unicode(lpszAnsi,lpUnicode)
char *lpszAnsi;
unsigned short *lpUnicode;
{
unsigned char *p = (unsigned char *)lpszAnsi, c;
unsigned short *t = lpUnicode;
unsigned int w;
size_t len;
int i, j;
char szTemp[5];
len = strlen(lpszAnsi);
while(*p){
if(*p < 0x81) *t++ = (unsigned short)(*p++);
else{
c = *(p+1);
if(c < 0x40) {
*t++ = (unsigned short)*p++;
*t++ = (unsigned short)*p++;
}
else{
i = *p - 0x81;
j = (c - 0x40) * 4;
strncpy(szTemp, &_UniCode[j], 4);
szTemp[4] = 0;
sscanf(szTemp, "%04X", &w);
*t++ = (unsigned short)w;
p += 2;
}
}
}
*t = 0;
len = (t - lpUnicode);
return len;
}