Question

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

Was it helpful?

Solution

You could try atoi.

OTHER TIPS

Use atoi or strtol.

int n = atoi(s)

you can also use sscanf

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top