头文件如下:
class CBig5Gby
{
public:
CBig5Gby();
~CBig5Gby(); void Big5togb(unsigned char *d,int l,unsigned char *dout,int *lout);protected:
void          Initi();//初始化
unsigned char m_Left;
bool          Leftflag;
int           BIG5Order[17954];
};
关键就是Big5togb函数,我不知道它的四个参数是什么意思?该怎么调用啊?

解决方案 »

  1.   

    我再把这个函数的实现贴出来,希望大家帮我鉴定一下该怎么调用,参数是什么意思,谢谢:
    void CBig5Gby::Big5togb(unsigned char *d,int l,unsigned char *dout,int *lout)
    {
    //连续性
    int id=0; if(Leftflag)
    {
    Leftflag = 0;
    // is English 是英文字符
    if(m_Left < 161 || d[id] < 64)
    {
    dout[id] = m_Left;
    id++;
    }
    else//是BIG5的汉字码
    {
    if(id+1>l)//一般不会出现 l==1
    {
    m_Left   = d[id];
    Leftflag = 1;
    (*lout) = id;
    return;
    } dout[id+1] = (BIG5Order[(m_Left - 161)*191 + d[id] -64]>>8)&0xff;
    dout[id  ] = (BIG5Order[(m_Left - 161)*191 + d[id] -64])&0xff; id += 2;
    }
    } while(l>=id)
    {
    // is English 是英文字符0xa1 =161,0x40=64
    if(d[id] < 161 || d[id+1] < 64)
    {
    dout[id] = d[id];
    id++;
    }
    else//是BIG5的汉字码
    {
    if(id+1>l)
    {
    m_Left   = d[id];
    Leftflag = 1;
    break;
    } dout[id+1] = (BIG5Order[(d[id] - 161)*191 + d[id+1] -64]>>8)&0xff;
    dout[id  ] = (BIG5Order[(d[id] - 161)*191 + d[id+1] -64])&0xff; id += 2;
    }
    } (*lout) = id;
    }
      

  2.   

    我的代码如下,IDC_EDIT1用来输入,IDC_EDIT1用于输出,如果输入英文和数字转换结果不变,但是如果输入中文的话,就变成了"烫烫..........":void CTest8Dlg::OnButton1() 
    {
    // TODO: Add your control notification handler code here
    CBig5Gby convert;
    CString cs;
    GetDlgItemText(IDC_EDIT1,cs);
    unsigned char*   c  =  new  unsigned char[cs.GetLength()+1];
    unsigned char* c2 = new  unsigned char[cs.GetLength()+1];
    memcpy(c,cs.GetBuffer(0),cs.GetLength()+1);  int m;
    convert.Big5togb((unsigned char*)c,cs.GetLength(),(unsigned char*)c2,&m);

    CString cs2;
    cs2.Format("%s",c2);
    SetDlgItemText(IDC_EDIT2,cs2);
    }
      

  3.   

    楼主,能否提供代码看看.
    [email protected]