Board index » delphi » Decimal to Hex Conversion
Brian
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Brian
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Decimal to Hex ConversionI am trying to develop a program that needs to convert some 8 digit numbers to their |
Valt
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Decimal to Hex ConversionOn 16 Jun 1996 04:19:20 GMT, you wrote: Quote>I am trying to develop a program that needs to convert some 8 digit numbers to their 89923210(base10) to base 16.... 89923210 / 16 = 5620200 remainder 10 89923210(base10) -=> 55C1E8A(base16) Double-check: 5*16^6+5*16^5+12*16^4+1*16^3+14*16^2+8*16^1+10*16^0 = 89923210 Get the idea? Also, as a suggestion, if you can bit shift to get the results (16 = |
Arjan Klee
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Decimal to Hex ConversionQuoteBrian <Br...@geographe.com.au> wrote: function (TP7) you will find a procedure called WriteHexWord. It writes, given a word, a Hex string. I think you can easily adjust this to your own needs. Hope this helps. Arjan Kleene |
Dr John Stockto
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Decimal to Hex ConversionIn article <4q0208$...@swing.iinet.net.au> of Sun, 16 Jun 1996 04:19:20 Quote>I am trying to develop a program that needs to convert some 8 digit numbers to 2^31, and can be read in to longints - tested, but not a lot. {$IFDEF WINDOWS} uses WinCrt ; {$ENDIF} function Hex(X : longint) : string ; var LI : longint ; begin repeat Readln(LI) ; Writeln(LI:10, Hex(LI):12) until false end. Efficiency was disregarded. |
The Maveri
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Decimal to Hex ConversionB> I am trying to develop a program that needs to convert some 8 digit numbers Yes.. here is program I made for that purpose.. I found the hex converter program hex_conv; var function Hex(v: Longint; w: Integer): String; begin |
erik
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Decimal to Hex ConversionQuoteBrian <Br...@geographe.com.au> wrote: digit numbers to their +-> hexadecimal equivalent. Can anyone help with some code or algorithm to complete this task? +-> thanks in advance. I hope the following unit helps: =========================================================================== UNIT Hex; {FINAL} (* Author: Erikc Sadler. Copyright (C) 1993 Erikc Sadler. ALL RIGHTS RESERVED. Function(s): Converts byte, word and longint values to INTERFACE {104/0} {uses nothing} FUNCTION HexByte( arg: BYTE): STRING; IMPLEMENTATION (* PROCEDURE xDigit; ASSEMBLER; {service to 'print' a hexdigit} (* (* (* END. Erikc Anything critical said of me by a religious zealot only |