日期:2014-05-19  浏览次数:20783 次

帮忙翻译一句源代码
C++中是:int   WINAPI   SW_ReceiveCID(int   nIndex,   char   *lpBuf);
例子是如下调用的:
BOOL   WINAPI   yzInitSystem()
{
char   buf[16];
int   i;

SW_Init();
SW_SetType(1);   //设置类型
                                LineCount=SW_GetCount();
strcpy(buf, "共 ");
itoa(LineCount,num,10);
strcat(buf,num);
strcat(buf, "线 ");
SetWindowText(GetDlgItem(hGWnd,IDC_LINE),buf);
                                for   (i=0;i <LineCount;i++)
                                {
                                                LineStatus[i]=0;     //线路状态
                                }
SetTimer(hGWnd,ID_TIME,20,TimerProc);  
return   TRUE;
}

在C#中应该如何写?
我如下写法
char[]   buf   =   new   char[50];
int   i;

                          int   LineCount=SW_GetCount();
                          for   (int   line   =   0;   line   <   LineCount;   line++)
                          {
                                  //收到CID处理
                                  i   =   SW_ReceiveCID(line,   buf);
                                  if   (i   ==   -1)
                                  {
                                          this.textBox1.Text   =   "4路电话语音盒是否安装! ";
                                          return;
                                  }
                                  else
                                          if   (i   !=   0)
                                          {
                                                  this.label2.Text   =   i.ToString();
                                                  this.textBox1.Text   =   "线 "   +   line.ToString()   +   ": ";