sscanf[
^] is also a widely used alternative.
In case of parsing in a number from a string you may have to handle 2 different kind of errors:
1. Was the conversion successful? (some implementations don't handle overflow)
2. How many characters were processed from the left side of the string? Some functions silently allow you to put garbage characters to the right side of the number in the string and those parser functions simply ignore the garbage. If you have to be strict without allowing garbage then you have to use the
strtol[
^] functions that helps you to detect the number of used characters.
EDIT: strtol also has the advantage of being able to parse numbers using arbitrary base: its possible to parse octal, hexa numbers too.