早教吧 育儿知识 作业答案 考试题库 百科 知识分享

请帮我把这段代码翻译成VC。VB代码如下:PrivateSubTimer1Timer()DimmAddrAsLongDimiAddrAsLongDimchbyteAsByteDimmValAsByteDimtempDimChByte1'AsByteDimChByte2'AsByteDimChByte3'AsByteDimiAsByteText1(0)

题目详情
请帮我把这段代码翻译成VC。VB代码如下: Private Sub Timer1_Timer() Dim mAddr As Long Dim iAddr As Long Dim chbyte As Byte Dim mVal As Byte Dim temp Dim ChByte1 'As Byte Dim ChByte2 ' As Byte Dim ChByte3 'As Byte Dim i As Byte Text1(0) = "" Text1(1) = "" Text1(2) = "" abs123(0) = "" abs123(1) = "" abs123(2) = "" ' mAddr = CLng(hextobcd("0")) ' mVal = hextobcd("0") temp = CH365WriteIoByte(CLng(0), CByte(0)) '指定地址为0 开始 temp = CH365WriteIoByte(CLng(1), CByte(0)) '写入数据申请 temp = CH365WriteIoByte(CLng(0), CByte(0)) '指定地址为0 开始 temp = CH365ReadIoByte(CLng(1), chbyte) '读取地址0的数据 If chbyte 0 Then Exit Sub '判断第一位是否为0 是零才进行读取 For i = 0 To 8 Step 1 If (mOpen -1) Then If (CH365ReadIoByte(CLng(1), chbyte)) Then abs123(0) = abs123(0) & Chr(chbyte) Else MsgBox "Read failed!" End If End If Next i For i = 0 To 8 Step 1 If (mOpen -1) Then If (CH365ReadIoByte(CLng(1), chbyte)) Then abs123(1) = abs123(1) & Chr(chbyte) ' MsgBox "Read success!" Else MsgBox "Read failed!" End If End If Next i For i = 0 To 8 Step 1 If (mOpen -1) Then If (CH365ReadIoByte(CLng(1), chbyte)) Then abs123(2) = abs123(2) & Chr(chbyte) ' MsgBox "Read success!" Else MsgBox "Read failed!" End If End If Next i Text1(0).Text = Format(Val(Text1(0).Text) / 25.4, "0.00000") Text1(1).Text = Format(Val(Text1(1).Text) / 25.4, "0.00000") Text1(2).Text = Format(Val(Text1(2).Text) / 25.4, "0.00000")
▼优质解答
答案和解析
if(chbyte!=0) return; 我只会这一句 C里没有字符串变量,只有字符数组
看了请帮我把这段代码翻译成VC。V...的网友还看了以下: