(Programming in C is a fun way to tie your mind in knots)
atoi("adhgsjgdas") = 0
if(sscanf(str, "%d", &int_var) != 1) { // handle the error!!!}