views:

451

answers:

3

What is the C equivalent of Convert.ToInt16(String) method of C#? In my case my string is a char array. Thanks

+5  A: 

You could try atoi.

I know there are some bit complications in some cases, but that one was enough to solve my case. thanks
cocoatoucher
+1  A: 

Use atoi or strtol.

int n = atoi(s)
Vinay Sajip
A: 

you can also use sscanf

sscanf("%i", myCharPointer, &myIntVar);

codymanix