Re: Converting a character array to single hex value
- From: "Nils O. Selåsdal" <noselasd@xxxxxxxxxxxxxxxxxxxxx>
- Date: 9 Jan 2006 22:40:33 +0100
Michael Mair wrote:
Nils O. Selåsdal wrote:nikNjegovan@xxxxxxxxx wrote:
so the idea is if the array is
[ '2','0','3','1','.','0','0' ]
then the output of the conversion would be
07EF (I'm not interested in the decimal and it can be truncated)
If you can convert that to an integer, you can format it as you like using printf/sprintf.
char foo[] = "2031.00";<snip>
The OP's first post specifically wanted foo to be char foo[7] = {'2','0','3','1','.','0','0'};
I didn't see that requirement specifically set, and even if it was, why not add an extra element to the not-overly-large array and add a nul terminator after he read the characters from his uart for simplicity ? .
- References:
- Converting a character array to single hex value
- From: nikNjegovan
- Re: Converting a character array to single hex value
- From: nikNjegovan
- Re: Converting a character array to single hex value
- From: "Nils O. Selåsdal"
- Re: Converting a character array to single hex value
- From: Michael Mair
- Converting a character array to single hex value
- Prev by Date: Re: Why such output?
- Next by Date: Re: x86 Stack Confusion
- Previous by thread: Re: Converting a character array to single hex value
- Next by thread: Re: Converting a character array to single hex value
- Index(es):
Relevant Pages
|