>Hi i am building an app using some API Calls, Everything works fine and i only have one funtion left to fix. The problem is the following:
>
>The data i receive from the Call is a 4 bytes Floating point and i really dont have a clue on how to convert the data i receive into the correct numeric value.
>
> The string i receive is Chr(174)+chr(216)+chr(255)+chr(63)+chr(0) And should convert to the numeric value 1.9988
>
That's a parameter type SINGLE, assuming that it's IEEE 754 compliant. As I remember, there's a bug related to the SINGLE parameter return value; Christof Lange and I have proven out the following code to convert a single contained in a VFP string (usually a part of a structure) back to a VFP numeric in straightforward fashion using RtlMoveMemory():
FUNCTION ConvertSINGLEToVFPNum
LPARAMETER tcSingle
DECLARE RtlMoveMemory IN WIN32API AS RtlCopyDbl ;
SINGLE @DestNumeric, ;
STRING @pVoidSource, ;
INTEGER nLength
LOCAL lnNum
lnNum = 0.000000000000000
=RtlCopyDbl(@lnNum, tcSingle, 4)
RETURN lnNum