Convert a string to an integer using atoi