将字节转换为单词 [英] convert byte to words

查看:166
本文介绍了将字节转换为单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么当我调用函数时,apper错误在

TextBox2.Text = convBytesWords(m(),o,p)



 公开  Form1 
公开 共享 w 作为 整数 = 32 ,r 作为 整数 = 20
公开 共享 ReadOnly e As Double = Math.E
公共 Const goldenRatio 正如 Double = 1 。 61803398874965
公共 共享 Pw 作为 整数 = CInt ( & HB7E15163),Qw As 整数 = CInt (& H9E3779B9)
公共 共享 S 作为 整数()
公共 共享 功能 convBytesWords(键作为 SByte (),u 作为 整数,c 作为 整数作为 整数()
Dim i 作为 整数
Dim tmp 作为 整数()= 整数(c - 1 ){}
For i = 0 tmp.Length - 1
tmp(i)= 0
下一步
i = 0
Dim off 作为 整数 = 0
while i< c
tmp(i)=((key(System.Math.Max(System.Threading.Interlocked.Increment( off ), off - 1 ))& HFF))((key(System.Math.Max(System.Threading.Interlocked.Increment( off ), off - 1 ))& HFF) < 8 ((key(System.Math.Max(System.Threading.Interlocked) .Increment( off ), off - 1 ))& HFF)<< 16 ((键(System.Math.Max(System.Threading.Interlocked.Increment( off ), off - 1 ))& HFF)<< 24
i + = 1
结束 虽然
返回 tmp
结束 功能
私有 Sub Button1_Click(发件人作为 对象,e As EventArgs)句柄 Button1.Click
Dim m < span class =code-keyword> As
Integer
m = Val(TextBox1.Text)
Dim o As 整数 = 4
Dim p As 整数 = 4
TextBox2.Text = convBytesWords(m(),o,p)
结束 Sub
结束 Class

解决方案

你想要的东西是: Encoding.GetString方法(字节[],Int32,Int32)



http://msdn.microsoft.com/en-us/library/05cts4c3(v = vs.110)的.aspx [<一个href =http://msdn.microsoft.com/en-us/library/05cts4c3(v=vs.110).aspx\"target =_ blanktitle =New Window> ^ ]

why when i make call to the function , apper error in
TextBox2.Text = convBytesWords(m(), o, p)

Public Class Form1
    Public Shared w As Integer = 32, r As Integer = 20
    Public Shared ReadOnly e As Double = Math.E
    Public Const goldenRatio As Double = 1.61803398874965
    Public Shared Pw As Integer = CInt(&HB7E15163), Qw As Integer = CInt(&H9E3779B9)
    Public Shared S As Integer()
    Public Shared Function convBytesWords(key As SByte(), u As Integer, c As Integer) As Integer()
        Dim i As Integer
        Dim tmp As Integer() = New Integer(c - 1) {}
        For i = 0 To tmp.Length - 1
            tmp(i) = 0
        Next
        i = 0
        Dim off As Integer = 0
        While i < c
            tmp(i) = ((key(System.Math.Max(System.Threading.Interlocked.Increment(off), off - 1)) And &HFF)) Or ((key(System.Math.Max(System.Threading.Interlocked.Increment(off), off - 1)) And &HFF) << 8) Or ((key(System.Math.Max(System.Threading.Interlocked.Increment(off), off - 1)) And &HFF) << 16) Or ((key(System.Math.Max(System.Threading.Interlocked.Increment(off), off - 1)) And &HFF) << 24)
            i += 1
        End While
        Return tmp
    End Function
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim m As Integer
        m = Val(TextBox1.Text)
        Dim o As Integer = 4
        Dim p As Integer = 4
        TextBox2.Text = convBytesWords(m(), o, p)
    End Sub
End Class

解决方案

Do you want something like: Encoding.GetString Method (Byte[], Int32, Int32) ?

http://msdn.microsoft.com/en-us/library/05cts4c3(v=vs.110).aspx[^]


这篇关于将字节转换为单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆