Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: changing hex to decimal

2009-08-04 by David Kelly

On Tue, Aug 04, 2009 at 08:36:59AM -0000, iijfet wrote:
> --- In AVR-Chat@yahoogroups.com, "aligole_2005" <aligole_2005@...> wrote:
> >
> > Hi friends
> > I want to make a function in Code vision to change a hexadecimal
> > byte to decimal or int, Can anybody help me? Maybe it 'll be good
> > that you know the hex data is stored in a string with the length of
> > 5 byte.
> > in fact I want to have the c code of the function that gives a char
> > or string hex data and give me the decimal data.
> >
> 
> this is:
> #include <stdio.h>
>  int main()
> 
>  {
>        int hexa;
> 
>       scanf("%x", &hexa);
>       printf("%d", hexa);
> 
>         return 0;
> 
>  }

scanf() and printf() are very expensive resource hogs.

-- 
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.