I need to either rewrite some functions into cf, or include a jsp file and call 
2 functions in there (see my jsp thread). To the former:

I don't know asp. I'm getting an error:

 The value "" cannot be converted to a number

254 :           op = op & "" & BitAnd( mid(op3 , i ,1), mid(op4 ,i ,1) );

Here is my translation. Can you see what I did wrong? I also tried ( mid(op3 , 
i ,1) AND mid(op4 ,i ,1) )

Thanks for any help.


/*
function andop(op1 , op2)
                op3 = cbin(op1) 
                op4 = cbin(op2)
                for i = 1 to 32
                op = op&""&(cint(mid(op3 , i ,1)) and cint(mid(op4 ,i ,1)))
                next
                andop = cdec(op)
end function
*/

function andop(op1 , op2)
{
        op3 = cbin(op1);
        op4 = cbin(op2);
        op = "";        //////// ??????????
        for (i = 1; i LTE 32; i=i+1)
        {
                op = op & "" & BitAnd( mid(op3 , i ,1), mid(op4 ,i ,1) );
        }
        return cdec(op);
}


/*
function cbin(num)
                do
                bin = cstr((num mod 2))&bin
                num = fix(num / 2)
                loop while not ((num = 0) )      

                for i = 1 to 32 - len(bin)
                        bin = "0"&bin
                next
                cbin = bin
end function
*/

 
// function used for decimal to binary conversion
function cbin(num)
{
        bin = "";       ///??
        do      
        {
                bin = (num mod 2) & bin;
                num = fix(num/2);
        }
        while (num NEQ 0); 

        for ( i = 1; i LTE (32-len(bin)); i=i+1)
        {
                bin = "0" & bin;
        }
        return bin;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241787
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to