>The best solution I can see right now: write a very small dll (in C or C++) with only one function. The function should look like this:
>
>
void Convert(LPCSTR tpszDestString, LPCSTR tpszSourceString, int tnLength)
>{
> float lnAFloat;
> double lnADouble;
>
> //-- Copy the contents of the source string
> // other the destination number.
> // This will "convert" to numeric...
> //-- Write the number as string into the dest buffer.
> if (tnLength == 4)
> {
> memcpy((void*)&lnAFloat, (void*)tpszSourceString, 4);
> sprintf(tpszDestString, "%f\0", lnAFloat);
> }
> else
> {
> memcpy((void*)&lnADouble, (void*)tpszSourceString, 8);
> sprintf(tpszDestString, "%f\0", lnADouble);
> }
>}
>
>I haven't tested this code, but it should work... maybe with some bug fixes... :)
>
>Vlad
>
>>Hello!
>> I'm using low level functions to read (import) a binary file (I think it was created with C/C++). Of course, every thing I read becomes a character. Is there an easy way (I mean a function or something like that) to "cast" a 4-byte character to a VFP Flotant point variable, and a 8-byte to Double?
>> I can do the "translation" step by step (I mean bit by bit) in VFP, but it takes too long, considering that I have to do 60,000 or so "interpretation" of this every time I read the file.
>>
>> TIA.
>>
>>Ing. Omar Zavala
Maybe I'm missing something but wouldn't it be something like this :
nValue = 0
for ix=1 to nBytes
nValue = nValue + asc(substr(cString,ix))*256^(ix-1)
endfor
Cetin