1 Reply Latest reply on Feb 6, 2016 12:39 AM by nasac_2167841

    I need a kbhit() equivalent

      I am using the WICED SDK 3.3.1.

      I need to be able to poll the serial input at stdin and not stop if nothing is present.  I can't use getchar() because it hangs waiting for the next character.  There is no kbhit() function that I can find like Windows has.  I also tried incorporating POSIX-compliant code for implementing the equivalent of kbhit():



        FD_SET(0, &rdset);  // 0 is the file descriptor for stdin

        timeout.tv_sec  = 0;

        timeout.tv_usec = 0;

        return select(1, &rdset, NULL, NULL, &timeout);  // 1 is one more than highest descriptor to check (0)


      but I need a select() function which I also cannot find in the library.

      Has anyone implemented this on this platform yet.