Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing an array in Memo field
Message
From
10/08/2012 10:44:19
 
 
To
10/08/2012 09:23:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01550185
Message ID:
01550294
Views:
55
>>>>>>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')
>		&&return asc(m.s)  + bitlshift(asc(substr(m.s,2,1)),8) + bitlshift(asc(substr(m.s,3,1)),16) + bitlshift(asc(substr(m.s,4,1)),24)
>	
>	case len(m.s) = 2
>		return ctobin(m.s, '2rs')
>		&& return asc(m.s)  + bitlshift(asc(substr(m.s,2,1)),8)
>		
>	otherwise
>		assert FALSE
>		return FALSE
>	
>	endcase
>endfunc
>*----------------------------------------------------------------------------
>function BinToChar(x)
>	
>	return bintoc(m.x, '4rs')
>	&& return	chr(bitand(m.x, 0xff)) + ;
>			chr(bitand(bitrshift(m.x,  8), 0xff)) + ;
>			chr(bitand(bitrshift(m.x, 16), 0xff)) + ;
>			chr(bitand(bitrshift(m.x, 24), 0xff)) ;
>				
>
>endfunc
>
Thx (and to Borislav), it's coming back to me a bit :-}
I've got CTOBIN().....
Thx also for the C# equivalent.
Don't think I'll get a chance to pursue this until after next week but I may take you up on your offer of extra help if I'm stuck....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform