I want to be able to use select() to work with entering a single char (no ENTER) from STDIN.
So, when a user press a single key, select() should return immediately, not waiting for the user to hit ENTER.
int main(void)
{
    fd_set rfds;
    struct timeval tv;
    int retval;
   /* Watch stdin (fd 0) to see when it has input. */
    FD_ZERO(&rfds);
    FD_SET(0, &rfds);
   /* Wait up to 2 seconds. */
    tv.tv_sec = 2;
    tv.tv_usec = 0;
   retval = select(1, &rfds, NULL, NULL, &tv);
   if (retval == -1)
        perror("select()");
    else if (retval)
        printf("Data is available now.\n");
    else
        printf("No data within five seconds.\n");
   exit(EXIT_SUCCESS);
}
This works but you have to hit the ENTER key to finish. I just want the select not wait for the user to hit the key and ENTER.
Thanks.
 
     
     
    