[comp.lang.pascal] Wanted : Routine to convert ASCII hex numbers into decimal value

shehzad@babel.SanDiego.NCR.COM (Mevawalla Shezad) (04/25/89)

I need a Turbo Pascal routine which will take as it's input a string of HEX
numbers in ASCII format (eg 0AB = 30 41 42 H) and convert it into a value of
type real. If anybody has written such a routine I would greatly appreciate 
it if you would mail it to me.

Thanks a lot.

-----------------------------------------------------------------------------
Disclaim, Disclaim, Disclaim, ... (ad infinitum)
Shehzad Mevawalla                               shehzad@babel.SanDiego.NCR.COM
(619) 746-2461                                  
------------------------------------------------------------------------------

ts@chyde.uwasa.fi (Timo Salmi LASK) (04/26/89)

In article <1290@ncr-sd.SanDiego.NCR.COM>
shehzad@babel.SanDiego.NCR.COM (Mevawalla Shehzad) writes:
>I need a Turbo Pascal routine which will take as it's input a string of HEX
>numbers in ASCII format (eg 0AB = 30 41 42 H) and convert it into a value of
>type real. If anybody has written such a routine I would greatly appreciate 
>it if you would mail it to me.

This is not quite what you are looking for but the list appended at
the end of this posting might be of interest to you.  You can
anonymous ftp tsbits16.arc from 128.214.12.3.  To anticipate a
question, the sources are not available. 

-------------------------------------------------------------------
Prof. Timo Salmi   
School of Business Studies, University of Vaasa,
P.O.Box 297, SF-65101 Vaasa, Finland
Internet: ts@chyde.uwasa.fi Funet: vakk::salmi Bitnet: salmi@finfun
-------------------------------------------------------------------

Searching Archive: B:TSBITS16.ARC - Bits and conversions by T.Salmi 

Filename        Comment                             Date      Time    CRC
--------        --------------------------------    ----      ----    ---
BINTODEC.EXE    Binary to decimal                 08-08-88  00:03:30  E3B9
BITWISE.EXE     Binary operations with 10-base    01-30-88  13:20:52  B776
COMDIV.EXE      Largest common divisor            12-31-88  19:46:36  A2D6
CONVBASE.EXE    Conversion between number bases   03-05-88  22:29:36  4169
DECTOBIN.EXE    Decimal to binary                 08-08-88  00:03:48  AFC2
DECTOHEX.EXE    Decimal to hexadecimal            08-08-88  00:04:04  384E
FACTORS.EXE     Factors etc. of integers          01-30-88  13:22:04  7F0A
HEXTODEC.EXE    Hexadecimal to decimal            08-08-88  00:04:38  A03A
TSBITS.INF      Document                          12-30-88  14:51:58  071F
TSPROG.INF      List of PD programs from T.Salmi  03-24-89  12:07:44  EC87
----            ------             ------  -----
0010            109557              89180   19%

shehzad@babel.SanDiego.NCR.COM (Mevawalla Shezad) (04/29/89)

Thanks a whole bunch to everyone who responded. I felt pretty stupid when I
realized how trivial the conversion routine was. A lot of people suggested
using the Turbo Pacal "Val" function. I was already aware of this but what
I actually needed was something which could convert Hex Strings > FFFFFFFF
which Val cannot do (i.e. type real). But even then the conversion was very 
simple. I was so bogged down with other programming tasks that I didn't stop
to think before I posted my request. When I finally did think about
it it took me all of 10 minutes to code the routine.

My humble apologies and many many thanks to all those who responded.

-----------------------------------------------------------------------------
Disclaim, Disclaim, Disclaim, ... (ad infinitum)
Shehzad Mevawalla                               shehzad@babel.SanDiego.NCR.COM
(619) 746-2461                                  
------------------------------------------------------------------------------