Convert Byte Array To Double 
Author Message
 Convert Byte Array To Double

Haya -

Does anyone have a good idea how to convert a Byte array to a Double?  I can
go the other way using LSet but I can't get that to work in this case

(The Type with the byte has to be the assignee otherwise it give a Type
mismatch).

Thanks in Advance!!!



Tue, 12 Mar 2002 03:00:00 GMT  
 Convert Byte Array To Double

Quote:

>Haya -

>Does anyone have a good idea how to convert a Byte array to a Double?  I can
>go the other way using LSet but I can't get that to work in this case

>(The Type with the byte has to be the assignee otherwise it give a Type
>mismatch).

>Thanks in Advance!!!

Tad,

Is this what you need?

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    pDest As Any, _
    pSource As Any, _
    ByVal ByteLen As Long)

Private Sub Command1_Click()

    Dim D As Double

    Dim BA(1 To 8) As Byte

    D = 1234.5678

    CopyMemory BA(1), D, Len(D)

    CopyMemory D, BA(1), Len(D)

    MsgBox D

End Sub

Best of luck,

Andrew J. Marshall, MCP
President
Object Vision, Inc.
5305 Berrywood Ct.
Fairfax, VA 22032
(703) 239-0022

http://www.ObjectVision.net

WARNING: Andrew has a bad habit of trying to be funny and failing. If he says
anything to offend you, it was probably a lame attempt at humor and he will
apologize on request.



Tue, 12 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Convert byte array to double? VB5.0

2. Convert Byte Array to Double.

3. Convert Byte Array to Double using CopyMemory

4. converting floating point dtaa from byte array to DOUBLE

5. Need to convert a 16 byte array of bytes to 4 byte integer

6. Converting a string array into a double array

7. Converting string array to byte array

8. how to use asp convert BIG5 ( Double bytes code ) to unicode (wml page )

9. converting double value into bytes

10. byte array to double

11. Double to Byte Array and Back

12. find double byte characters in a single byte string

 

 
Powered by phpBB® Forum Software