Unbuffered I/O in ANSI C

前端 未结 3 1538
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 01:37

For the sake of education, and programming practice, I\'d like to write a simple library that can handle raw keyboard input, and output to the terminal in \'real time\'.

3条回答
  •  庸人自扰
    2020-12-07 02:23

    This is not possible using only standard ISO C. However, you can try using the following:

    #include 
    void setbuf(FILE * restrict stream, char * restrict buf); 
    

    and related functions.

    Your best bet though is to use the ncurses library.

提交回复
热议问题