I am writing a simple Objective – C console app.
I only want to accept digits.
Even if i type a character which is not a digit, it should not be echoed back.
and I should have a character array that has all digits on which i can use atoi().
scanf has formatters but they dont work the way i want.
I know it should be possible. The way it works when u enter passwords in terminal,
they are just accepted but not echoed back.
I just want a variation of it.
Is there some C function that only accepts a character and returns it but doesn’t echoes it back on screen ?
Check out these link for more info What is Equivalent to getch() & getche() in Linux?
you can use getch() but if there is no getch() then you can try the below code.
Getch function gets the characters but does not echo to screen.
Thanks