vb,求怎样将4字节字符串转换为一单精度浮点数??

2025-04-06 12:23:38
推荐回答(1个)
回答1:

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Function Str2Single(s As String) As Single
If LenB(s) < 4 Then s = s & String(4, 0)
CopyMemory Str2Single, ByVal (StrPtr(s)), ByVal 4
End Function