Re: Hex writing doesn't work?

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun, 23 Apr 2000 23:20:06 -0300, Caballero Rojo
<pampeano at ROCKETMAIL.COM> wrote:

>Thanks Bernie and Lucius for answering my question, but I'm afraid
>that I use that answers.
>Bernie, your's print the number like a string, and I want to write a
>hex number to make an string.
>And Lucius answer doesn't work =(
>
>Any other solution?

Your description is unclear, but I think I understand... :)

I think you're wanting to do this:
    #4E23  as a number --> "4E23" as a string, without printing it.

For this you need the sprintf() function (notice the extra 's')
Then you can do this:
    sequence hexstring
    integer  hexval
    hexval = #4E23
    hexstring = sprintf("%04x", hexval)

I don't even need to write a function this time. :)

Hope this is what you wanted,
Carl

--
Carl R. White       - Software Tester @ CTD - Carl- at -comodo.net
Cyrek the Illogical -          Geek         - cyrek- at -bigfoot.com
         Remove hyphens before mailing s'il vous plait...

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu