Results 1 to 3 of 3

Thread: kbhit() for NIOS terminal

  1. #1
    Join Date
    Nov 2006
    Posts
    11
    Rep Power
    1

    Default

    I need an implementation of kbhit() for the nios terminal in eclipse. I found the following example

    #include <termios.h>

    int kbhit(void)
    {
    struct termios term, oterm;
    int fd = 0;
    int c = 0;
    tcgetattr(fd, &oterm);
    memcpy(&term, &oterm, sizeof(term));
    }


    i tried but i got an error, so i insertet the function "tcgetattr" directly

    #include <termios.h>
    #include <sys/ioctl.h>

    int
    tcgetattr(int fd,struct termios *termios_p)
    {
    return ioctl(fd,TCGETS,termios_p);
    }

    -> Now i have the problem, that he can&#39;t find "TCGETS" !! it seems to be defined nowhere ?????

  2. #2
    Join Date
    Mar 2012
    Location
    Glendale, CA
    Posts
    1
    Rep Power
    1

    Default Re: kbhit() for NIOS terminal

    Hi,

    Did you solve this non-blocking getch() issue. I have searched and searched to no avail. My next thought would be to create a thread to do it...
    Thanks

    Simon

  3. #3
    Join Date
    Apr 2004
    Location
    Palo Alto, CA
    Posts
    858
    Rep Power
    1

    Default Re: kbhit() for NIOS terminal

    fcntl() should be supported, non-blocking operations (including getch()) certainly are.

Similar Threads

  1. kbhit() in C
    By omikron123 in forum General Discussion Forum
    Replies: 2
    Last Post: February 1st, 2007, 10:40 PM
  2. nios terminal error
    By cuimi in forum General Discussion Forum
    Replies: 0
    Last Post: June 4th, 2006, 06:35 AM
  3. nios terminal error
    By cuimi in forum Linux Forum
    Replies: 1
    Last Post: June 2nd, 2006, 03:21 AM
  4. nios2-terminal
    By pairin20 in forum Linux Forum
    Replies: 6
    Last Post: May 8th, 2006, 02:03 AM
  5. nios2-terminal
    By imported_andy in forum General Software Forum
    Replies: 1
    Last Post: September 6th, 2005, 11:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •