请教如何把二进制的值转换为double类型的值?[已解决]
本帖最后由 冲击波 于 2012-2-20 21:33 编辑请教如何把二进制的值转换为double类型的值?
先谢谢了 Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $double, $INT,$byte
$double = 1.31742
$INT = doubleToBYTE8($double)
MsgBox(0,"double转8字节",$INT)
$byte=BYTE8Todouble($INT)
MsgBox(0,"8字节转double",$byte)
EndFunc ;==>_Main
Func doubleToBYTE8($nFloat)
Local $tFloat = DllStructCreate("double")
Local $tInt = DllStructCreate("byte", DllStructGetPtr($tFloat))
DllStructSetData($tFloat, 1, $nFloat)
Return DllStructGetData($tInt, 1)
EndFunc
Func BYTE8Todouble($nFloat)
Local $tFloat = DllStructCreate("byte")
Local $tInt = DllStructCreate("double", DllStructGetPtr($tFloat))
DllStructSetData($tFloat, 1, $nFloat)
Return DllStructGetData($tInt, 1)
EndFunc 2楼高手啊! ok了,多谢了兄弟.
自己弄了很久都不行.再次感谢
页:
[1]