Re: help needed on coversin of an char array to an integer
- From: "Bartc" <bc@xxxxxxxxxx>
- Date: Thu, 21 Feb 2008 19:55:38 GMT
"MAx" <mahesh1280@xxxxxxxxx> wrote in message
news:6f4d18ab-ae46-4064-9d51-7251a738f646@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
Im kinda stuck in a project at a point where i need an array to
be converted to a
integer using some kind of math.
This board does not support functions like scanf, sscanf etc as
it does not have enough memory to hold their stack.
given a string char str[8] = {'0', '0', '0' , '1' , 'f' , 'b' ,
'c' , 'a' };
i need a function which can convert this array to an integer
( 0x0001fbca )
I assume sometimes the string will be something else? Otherwise it's rather
trivial.
Where are the hex digits coming from? If from a hex keyboard, then each
digit may already be 0 to 15 then combining to an integer value is very easy
(each digit corresponds to a 4-bit chunk).
Complete solutions have already been posted, the only tricky bit is
converting each character, 0 1 2 3 4 5 6 7 8 9 a b c d e f (and maybe A B C
D E F?) to a value 0 to 15.
--
Bart
.
- Follow-Ups:
- References:
- Prev by Date: Re: compare two float values
- Next by Date: Re: compare two float values
- Previous by thread: Re: help needed on coversin of an char array to an integer
- Next by thread: Re: help needed on coversin of an char array to an integer
- Index(es):
Relevant Pages
|