You should use strtol() all the time.
atoi() for example cannot detect numeric overflow.