FUNCTION NumToBinLong * * Creates a 4 byte signed binary int equivalent to a C long from a number * * Parameters: * * tnNum (R) Number to convert * LPARAMETER tnNum LOCAL x,n,i,b[4],neg IF tnNum<0 x=INT(-tnNum) neg=.t. ELSE x=INT(tnNum) neg=.f. ENDIF FOR i=3 TO 0 STEP -1 n=INT(x/(256^i)) b[i+1]=IIF(neg, IIF(i=0, 256, 255)-n, n) x=MOD(x,(256^i)) ENDFOR IF neg FOR i = 1 TO 3 IF b[i] = 256 b[i] = 0 b[i+1] = b[i+1] + 1 ENDIF ENDFOR ENDIF RETURN CHR(b[1])+CHR(b[2])+CHR(b[3])+CHR(b[4]) FUNCTION LongToNum * Take a binary Long and convert it to a VFP Numeric LPARAMETER tcLong LOCAL b0,b1,b2,b3,nRetVal b0=asc(tcLong) b1=asc(subs(tcLong,2,1)) b2=asc(subs(tcLong,3,1)) b3=asc(subs(tcLong,4,1)) if b3<128 nRetVal = ( ( (b3*256 + b2)*256 + b1) * 256 + b0) else b3=255-b3 *Note this is 2's complement, thus 255! b2=255-b2 b1=255-b1 b0=256-b0 nRetVal= -( ( (b3*256 + b2)*256 + b1) * 256 + b0) endif RETURN nRetVal>>One followup here - the QUAD code I left converts between DWORDs and VFP; the code will work fine as long as the number being converted is a positive integer in the range 0 to (2^31 - 1); if you have negative numbers, they'll convert incorrectly to values 2^31 or greater. I can post code for NumToBINLong and BINLongToNum if there's any need (I don't know what the code on your Web page does; I'm sure everyone and his brother has code that does this correctly by now...)