getch() vs getchar()

来源:互联网 发布:人工智能平台有哪些 编辑:程序博客网 时间:2024/05/16 19:54
        getch () is defined in conio.h which is non standard C, so some compilers won't have it, getchar () is in stdio.h.

        they work differently too, getch wont display any text on screen - the moment you press a key it is entered - you don't press enter. a nice way of reading in a single character without needing to flush the input buffer afterwards.

        getch() is really handy for menu programs.

原创粉丝点击