Reading a single character in C

前端 未结 5 594
攒了一身酷
攒了一身酷 2020-11-29 09:27

I\'m trying to read a character from the console (inside a while loop). But it reads more than once.

Input:

a

Output:



        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 09:57

    you could always use char a = fgetc (stdin);. Unconventional, but works just like getchar().

提交回复
热议问题