Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to convert ASCII characters into numeric values in KEIL

Status
Not open for further replies.

te04-0202

Junior Member level 1
Junior Member level 1
Joined
Jun 17, 2008
Messages
16
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,373
keil itoa

How to convert ASCII characters into numeric values in KEIL COMPILER.
 

keil ascii to character

if you want to convert a single character :

Code:
char c = '5';
int a = c - '0'; // now a = 5

if you want to convert an ascii array:
Code:
int a = 0;
char num[] = {'1' , '9' , '3' };

a = conv( num , 3 ); // now ans=193
.
.
.
int conv( char arr[] , char len )
{
    int ans = 0;
    char i;
    for( i = 0 ; i < len; i++ )
    {
        ans *= 10;
        ans += arr[i]-'0';
    }
    return ans;
}
 

    te04-0202

    Points: 2
    Helpful Answer Positive Rating
character ascii keil c

te04-0202 said:
How to convert ASCII characters into numeric values in KEIL COMPILER.


HAI,
you can use below a to i function in keil also.nothing wrong.
int i;
char s [] = "12345";

i = atoi (s);
 

    te04-0202

    Points: 2
    Helpful Answer Positive Rating
keil char to ascii

How to convert an integer into character.
 

keil get ascii code

Hi,

I think you can try to use the fomula.
Code:
No = No * 10 + ch - '0';
Good Luck.
 

    te04-0202

    Points: 2
    Helpful Answer Positive Rating
Re: How to convert ASCII characters into numeric values in K

te04-0202 said:
How to convert an integer into character.


HAI,
for this you have to use itoa.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top