|
发表于 2012-2-20 18:33:11
|
显示全部楼层
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[8]", DllStructGetPtr($tFloat))
DllStructSetData($tFloat, 1, $nFloat)
Return DllStructGetData($tInt, 1)
EndFunc
Func BYTE8Todouble($nFloat)
Local $tFloat = DllStructCreate("byte[8]")
Local $tInt = DllStructCreate("double", DllStructGetPtr($tFloat))
DllStructSetData($tFloat, 1, $nFloat)
Return DllStructGetData($tInt, 1)
EndFunc |
评分
-
查看全部评分
|