I had to simulate pack(L) from perl. I don't know if this will help, but I
figured I would share it.
/*
create_perl_packed_string_L
This simulates the command pack ("L", $now) function from
perl. It converts a number from numerals into the asci
character representation of it's 32 bit binary form.
*/
function create_perl_packed_string_L(number)
{
// convert number to binary
bin_number=formatBaseN(number,2);
// Figure out how many 0's make it 32 bit
bin_number_length=Len(bin_number);
prepend_count=32- bin_number_length;
prepend="";
for (i=1;i lte prepend_count; i=i+1)
{
prepend = prepend & "0";
}
// add prefixed 0's
bin_number= prepend & bin_number;
//break into octets
octet_array=arrayNew(1);
j=1;
for (i=1; i lte 32; i=i+8)
{
octet_array[j]=Mid(bin_number,i,8);
j=j+1;
}
//convert to proper string
packed_string="";
for (i=1; i lte 4; i=i+1)
{
packed_string=packed_string &
Chr(InputBaseN(octet_array[i],2));
}
return(packed_string);
}
Terrence Ryan
I.T. Director
Wharton Computing and Information Technology
E-mail: [EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289589
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4