To do what you want, it would be simplest (probably) to keep the source string intact, and use "strncpy" to copy the portions you want into a temporary buffer, and then apply "atoi" to the temporary buffer.
To do what you want, it would be simplest (probably) to keep the source string intact, and use "strncpy" to copy the portions you want into a temporary buffer, and then apply "atoi" to the temporary buffer.