Reading FKeys in curses

This is a discussion on Reading FKeys in curses within the C Programming forums, part of the General Programming Boards category; hello all, Have a question on ncurses: i am trying to acitvate the Function keys(at the top of the keyboard) ...

  1. #1
    Unregistered
    Guest

    Question Reading FKeys in curses

    hello all, Have a question on ncurses:

    i am trying to acitvate the Function keys(at the top of the keyboard) by writting the following codes:


    ch = getch();
    if (ch == KEY_F(1))
    printw("F1 key pressed");

    now, my problem is that for some reason the function key is not read and the printw function does not work! is there another(ulternative) function that i should be using?

    tnx,
    ben

  2. #2
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Use int WaitForChar; then,

    WaitForChar=getch();
    switch(WaitForChar)
    {
    case 27: // If the user presses escape
    // Do this stuff

    default:
    // Your default case
    }

    Keyboard Scan Codes
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 03-05-2009, 03:14 AM
  2. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  3. Replies: 2
    Last Post: 01-28-2008, 03:07 AM
  4. reading file word by word
    By 98holb in forum C Programming
    Replies: 2
    Last Post: 01-25-2006, 05:49 PM
  5. file reading
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 03-12-2002, 11:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21