R
Rick
Hi,
Another newbie question. I'm trying to convert a char to an integer. My
input is a string which holds a number on place 4. However, if I try
int number = atoi( input[3] );
I'll get an error because of the type conversion I guess. Atoi wants a
string while I put a single char into it. So I tried it another way:
char s[2];
int number;
s[0] = input[3];
s[1] = 0;
number = atoi( s );
That worked but aren't their better ways?
Greetings,
Rick
Another newbie question. I'm trying to convert a char to an integer. My
input is a string which holds a number on place 4. However, if I try
int number = atoi( input[3] );
I'll get an error because of the type conversion I guess. Atoi wants a
string while I put a single char into it. So I tried it another way:
char s[2];
int number;
s[0] = input[3];
s[1] = 0;
number = atoi( s );
That worked but aren't their better ways?
Greetings,
Rick