Thx!
I need to convert part of a character array into integer and am wondering how.
How to convert string into integer ?
How to convert string into content of a character array ?
I ask these questions because I think the atoi thing on C++.com may be able to do these. It need an entire character array but in my case, I only need part of a character array for conversion to integer.
This is the example on c++.com:
Code:
/* atoi example */
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i;
char szInput [256];
printf ("Enter a number: ");
gets ( szInput );
i = atoi (szInput);
printf ("Value entered is %d, and its double %d",i,i*2);
return 0;
}
Output:
Enter a number: 73
Value entered is 73, and its double 146