Below code is an example of nonblocking read of `terminal` IO, however when I type a character on the console, it doesn't immediately print it out. Perpaps you will say I should priviously set `stty -icanon`, so canonical mode is disabled, that indeed works, but I think even though I don't disable `stty icanon`, nonblocking read of terminal is `character-oriented`, `cannonical` mode just wakes up the blocking process, but my process is not blocking, if we type a character, then the fd is readable, so it should immediately print the character out.

```
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>

#define MSG_TRY "try again\n"

int main(void)
{
 char buf[10];
 int fd, n;
 fd = open("/dev/tty", O_RDONLY|O_NONBLOCK);
 if(fd<0) {
    perror("open /dev/tty");
    exit(1);
 }
 tryagain:
   n = read(fd, buf, 10);
   if (n < 0) {
       if (errno == EAGAIN) {
            sleep(1);
            write(STDOUT_FILENO, MSG_TRY, strlen(MSG_TRY));
            goto tryagain;
       }    
    perror("read /dev/tty");
    exit(1);
   }
 write(STDOUT_FILENO, buf, n);
 close(fd);
 return 0;
}

```