Jump to content
Sign in to follow this  
monitorlg

Conversion from Decimal to Byte Value

Recommended Posts

monitorlg

Hi All,

I am writing a script where i have to form a packet, such that when i frame the decimal value it should convert it into byte value.

Can any body suggest me which all function to use in this conversion.

Share this post


Link to post
Share on other sites
Authenticity

ANDing the decimal with 0x000000FF is enough I believe.

Share this post


Link to post
Share on other sites
PsaltyDS

Hi All,

I am writing a script where i have to form a packet, such that when i frame the decimal value it should convert it into byte value.

Can any body suggest me which all function to use in this conversion.

What form is the decimal number in to start with? If it is an integer type already, it doesn't need conversion. The number is already stored as a binary word, it is just presented to you converted to decimal.

If it is an ANSI or Unicode string representation of a decimal number, then you can get an integer type with just Int() or Number().

ANDing the decimal with 0x000000FF is enough I believe.

That will only work if it's a single decimal digit, and is already converted to an integer type (vice string).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.