Can I see a functional implementation just for educational purposes here? I don't understand really because I have casted things in C like that before (not in lieu of atoi() with (int) char as shown, but other datatypes) and because in my experience, when I have a read out a string, I have not gotten an ASCII keycode, but the inputted character. Most of my C experience has been on existing open-source projects, so maybe they'd already implemented stuff that glossed over all this.
That said, I don't really understand why this should be a consideration for the programmer at all. C's type system seems to get in the way and slow things down almost as much as it helps (again, limited C experience here) and I don't think that's how these things should work.
Castings in c doesn't perform type conversion, regarding the implementation just consider that every ascii char has a numerical code (it's int value) and that in the ascii table the numbers are adjacent.
That said, I don't really understand why this should be a consideration for the programmer at all. C's type system seems to get in the way and slow things down almost as much as it helps (again, limited C experience here) and I don't think that's how these things should work.