0

how to use getchar() to avoid an enter?

please help me ,thanks!

12th Apr 2018, 3:31 PM
Edc Yang
3 Antworten
0
get char only takes one character you better use fgets btw here is how you use getchar- #include <stdio.h> int main() { char name; puts("Enter your name"); name = getchar(); puts("Name entered: "); putchar(name); return 0; }
12th Apr 2018, 3:39 PM
Akib
Akib - avatar
0
If you need direct input I can recommend you "system ("/bin/stty raw"); " for linux systems or libraries like ncurses
12th Apr 2018, 3:39 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
0
ty guys so much!
12th Apr 2018, 3:43 PM
Edc Yang