Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 30 Jun 2015, 13:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Function keys and rxvt term with ncurses/curses
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count_1  
Author Message

Joined: 10 Jul 2013
Posts: 77

PostPosted: Sat 22 Feb 2014, 11:46    Post_subject:  Function keys and rxvt term with ncurses/curses
Sub_title: Not functioning...

So I am trying to cobble togeather my menu system and I figured - ncurses/curses can do everything I want (and more).

But I cannot get the function keys to respond.


#include <ncurses.h>

int main()
{   int ch;

   initscr();         /* Start curses mode       */
   raw();            /* Line buffering disabled   */
   keypad(stdscr, TRUE);      /* We get F1, F2 etc..      */
   noecho();         /* Don't echo() while we do getch */

       printw("Type any character to see it in bold\n");
   ch = getch();         /* If raw() hadn't been called
                * we have to press enter before it
                * gets to the program       */
   if(ch == KEY_F(1))      /* Without keypad enabled this will */
      printw("F1 Key pressed");/*  not get to us either   */
               /* Without noecho() some ugly escape
                * charachters might have been printed
                * on screen         */
   {   printw("The pressed key is ");
      printw("%c", ch);
   refresh();         /* Print it on to the real screen */
       getch();         /* Wait for user input */
   endwin();         /* End curses mode        */

   return 0;

What I don't understand is

keypad(stdscr, TRUE);

should enable the reading of function keys but its not working...

any ideas? Confused
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count_1  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0394s ][ Queries: 12 (0.0031s) ][ GZIP on ]