>>I am trying to convert a character field (which is really a character represetation of a binary number, for example, 01010) to decimal (in this case 10). Is there a built-in function in VFP that can do that?
>>
>>How about the reverse (going from decimal to binary)?
>
>Don't know about such a function but try this.
>Local lnTel,lenght,lcBin,lnDec
>lcBin="01010"
>lnLenght = Len(lcBin)
>For lnTel = 1 to lnLenght
> lnDec = iif(SubStr(lcBin,lnLenght-lnTel+1,1)='1',BitSet(lnDec,lntel),lnDec)
>EndFor
>for the reverse you can do the same.
Only problem here is that it's off by one.
George
Ubi caritas et amor, deus ibi est