一个浮点数占4个字节,如何获得一个浮点数转换而来的四个字节的数字呢?还有如何将四个字节数据转换成一个浮点数!
在VB60中可以很方便的将浮点数得到四个字节,或者相反的操作,比如,将4个字节转换成一个浮点数,
Public Type mybyte
my_byte(3) As Byte
End Type
Public Type mysingle
my_single As Single
End Type
Public Function b_s(g0 As Byte, g1 As Byte, g2 As Byte, g3 As Byte)
Dim yourbyte As mybyte
Dim yoursingle As mysingle
yourbyte.my_byte(0) = g3
yourbyte.my_byte(1) = g2
yourbyte.my_byte(2) = g1
yourbyte.my_byte(3) = g0
LSet yoursingle = yourbyte
b_s = yoursingle.my_single
End Function
dim sglTemp as single
sglTemp =b_s(100,200,100,100)
就可以将100,200,100,100四个字节转换出一个浮点数了
请问:在vb.net如何实现?!!