>>>>>Hi,
>>>>>
>>>>>I have a VFP table with a Memo field which holds a couple of variables and a two dimensional numeric array (populated by SAVE TO xxx ALL LIKE Flash*), Is the binary format in which these are stored known to anyone?
>>>>>
>>>>>I haven't worked with VFP for quite a while but cannot recall, or find on the web, anything on this......
>>>>>
>>>>>TIA,
>>>>>Viv
>>>>
>>>>
>>>>Yes, Viv - see (old) download#
15242 - should get you started
>>>
>>>Thx. Haven't a chance to look at it yet but sounds promising.....
>>
>>Sounds like an interesting thing to do - shout if you need any help
>
>Boy have I forgotten VFP ! Where does CharToBin() come from ?
I was thinking to have a go at it - but I'm struggling to write a class - vfpvariable
Going from the untyped world to the typed world is a challenge here
Possibilities
(1) use an enum to indicate the type and have one field per type
enum ValueType = ...
ValueLogical
ValueNumeric
...
(2) use an object as value
But either approach is a headache (tests, too much code) when it comes to assigne the value
Perhaps Dynamic ?
This code is 10 year old -
If your vfp version does not support ctobin(m.s, '4rs'), then use the commented line below
function CharToBin(s)
do case
case len(m.s) = 4
return ctobin(m.s, '4rs')
case len(m.s) = 2
return ctobin(m.s, '2rs')
otherwise
assert FALSE
return FALSE
endcase
endfunc
function BinToChar(x)
return bintoc(m.x, '4rs')
chr(bitand(bitrshift(m.x, 8), 0xff)) + ;
chr(bitand(bitrshift(m.x, 16), 0xff)) + ;
chr(bitand(bitrshift(m.x, 24), 0xff)) ;
endfunc
Gregory