It could also help if the implicit call to
_exit(0) fails. It never does, though.
Also, there are if_integer and str2int functions in standard
C, let alone C++.
It's called
strtol. To get an int x from stdin:
Code:
char * str = malloc(200);
str = fgets(str,200,stdin);
char * s2;
int x = strtol(s,NULL,10);
free(s);