1. Binary to Hexadecimal

Hi to everyone, I want your help to some code about converting binary
numbers (8-bit) to hexadecimal values.
 If anyone have some idea or code, it will be very helpful.
 Thank you!

Eduardo Uemura Okada
e-mail: cool at art.com.br

new topic     » topic index » view message » categorize

2. Re: Binary to Hexadecimal

On Tue, 12 Aug 1997 19:57:47 -0300 Eduardo Uemura Okada <cool at ART.COM.BR>
writes:
>
> Hi to everyone, I want your help to some code about converting binary
>numbers (8-bit) to hexadecimal values.
> If anyone have some idea or code, it will be very helpful.
> Thank you!
>
>Eduardo Uemura Okada
>e-mail: cool at art.com.br
>

Please,

I do enjoy answering questions.
PLEASE read your documentation.
Search your documentation.

In the normal Euphoria Editor press

ESC f
<printf
ENTER

read that information. THEN press

ESC f
<sprintf
ENTER

read that information.
There lies your answer.

        Sincerely Lucius L. Hilley III.

include get.e--used here for the value() command.
sequence s
s = sprintf(1, "%x", 156)--get hex for 156
puts(1, s & "\n")--print hex of 156
puts(1, value("#" & s))--print value of hex of 156
                        --which is 156

        GOOD DAY

--Lucius Lamar Hilley III
--  E-mail at luciuslhilleyiii at juno.com
--  JUNO JUNO JUNO.  I use JUNO and
--  I support transferring of files less than 60K.
--  I can Decode both UU and Base64 format.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Binary to Hexadecimal

Lucius L Hilley III wrote:

> include get.e--used here for the value() command.
> sequence s
> s = sprintf(1, "%x", 156)--get hex for 156
> puts(1, s & "\n")--print hex of 156
> puts(1, value("#" & s))--print value of hex of 156
>                         --which is 156
>
I don't think this will work. Try, for example, using these routines to
print 11011110 (binary) in hex (or decimal, for that matter)

Irv

new topic     » goto parent     » topic index » view message » categorize

4. Re: Binary to Hexadecimal

On Wed, 13 Aug 1997 16:44:30 -0500 Irv <mountains at mindspring.com> writes:
>
>Lucius L Hilley III wrote:
>
>> include get.e--used here for the value() command.
>> sequence s
>> s = sprintf(1, "%x", 156)--get hex for 156
>> puts(1, s & "\n")--print hex of 156
>> puts(1, value("#" & s))--print value of hex of 156
>>                         --which is 156
>>
>I don't think this will work. Try, for example, using these routines
>to
>print 11011110 (binary) in hex (or decimal, for that matter)
>
>Irv

Okay.  I failed to understand your question.
11011110 would be
"11011110" which is {49,49,48,49,49,49,49,48}
meaning you can do this:

integer i
sequence s

s = "11011110"
s = s - 48
--s now equals {1,1,0,1,1,1,1,0}
--now you can use bits_to_int()
i = bits_to_int(s)

--now yoiu can use the before mention methods.

--Lucius Lamar Hilley III
--  E-mail at luciuslhilleyiii at juno.com
--  JUNO JUNO JUNO.  I use JUNO and
--  I support transferring of files less than 60K.
--  I can Decode both UU and Base64 format.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu