MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Curses Library Functions                      cursgetch(3CURSES)



NAME
     cursgetch, getch, wgetch, mvgetch, mvwgetch, ungetch -  get
     (or push back) characters from curses terminal keyboard

SYNOPSIS
     cc [ flag ... ] file ... -lcurses [ library ... ]
     #include 

     int getch(void);


     int wgetch(WINDOW *win);


     int mvgetch(int y, int x);


     int mvwgetch(WINDOW *win, int y, int x);


     int ungetch(int ch);


DESCRIPTION
     With the getch(), wgetch(), mvgetch(), and  mvwgetch()  rou-
     tines  a character is read from the terminal associated with
     the window. In no-delay mode, if no input  is  waiting,  the
     value  ER  is  returned.  In  delay mode, the program waits
     until the system passes text through to the program. Depend-
     ing  on the setting of cbreak(), this is after one character
     (cbreak mode), or after the first newline  (nocbreak  mode).
     In  half-delay  mode, the program waits until a character is
     typed or the specified timeout has been reached. Unless noe-
     cho()  has  been set, the character will also be echoed into
     the designated window.


     If the window is not a pad, and it has been moved  or  modi-
     fied  since  the last call to wrefresh(), wrefresh() will be
     called before another character is read.


     If keypad() is TRUE, and a  function  key  is  pressed,  the
     token  for  that function key is returned instead of the raw
     characters. Possible function keys are defined in 
     with  integers  beginning  with 0401, whose names begin with
     KEY. If a character that could be the beginning of a  func-
     tion  key (such as escape) is received, curses sets a timer.
     If the remainder of the sequence does not come in within the
     designated time, the character is passed through; otherwise,
     the function key value is returned. For  this  reason,  many
     terminals experience a delay between the time a user presses



SunOS 5.11          Last change: 31 Dec 1996                    1






Curses Library Functions                      cursgetch(3CURSES)



     the escape key and the escape is returned  to  the  program.
     Since  tokens  returned  by  these  routines are outside the
     ASCI range, they are not printable.


     The ungetch() routine places ch back onto the input queue to
     be returned by the next call to wgetch().

  Function Keys
     The following function keys, defined in , might be
     returned  by getch() if keypad() has been enabled. Note that
     not all of these may be supported on a  particular  terminal
     if the terminal does not transmit a unique code when the key
     is pressed or if the definition for the key is  not  present
     in the terminfo database.



                Name                           Key name
     
     KEYBREAK                     Break key
     KEYDOWN                      The four arrow keys ...
     KEYUP
     KEYLEFT
     KEYRIGHT
     KEYHOME                      Home key (upward]left arrow)
     KEYBACKSPACE                 Backspace
     KEYF0                        Function keys; space for 64 keys
                                   is reserved.
    KEYF(n)                      For 0 < n < 63
    KEYDL                        Delete line
    KEYIL                        Insert line
    KEYDC                        Delete character
    KEYIC                        Insert char or enter insert mode
    KEYEIC                       Exit insert char mode
    KEYCLEAR                     Clear screen
    KEYEOS                       Clear to end of screen
    KEYEOL                       Clear to end of line
    KEYSF                        Scroll 1 line forward
     KEYSR                       Scroll 1 line backward (reverse)
    KEYNPAGE                     Next page
    KEYPAGE                     Previous page
    KEYSTAB                      Set tab
    KEYCTAB                      Clear tab
    KEYCATAB                     Clear all tabs
    KEYENTER                     Enter or send
    KEYSRESET                    Soft (partial) reset
    KEYRESET                     Reset or hard reset
    KEYPRINT                     Print or copy






SunOS 5.11          Last change: 31 Dec 1996                    2






Curses Library Functions                      cursgetch(3CURSES)



    KEYL                        Home  down  or   bottom   (lower
                                  left).  Keypad  is arranged like
                                  this: (Row 1) A1   up    A3 (Row
                                  2)  left   B2   right (Row 3) C1
                                  down   C3
   KEYA1                        Upper left of keypad
   KEYA3                        Upper right of keypad
   KEYB2                        Center of keypad
   KEYC1                        Lower left of keypad
   KEYC3                        Lower right of keypad
   KEYBTAB                      Back tab key
   KEYBEG                       Beg(inning) key
   KEYCANCEL                    Cancel key
   KEYCLOSE                     Close key
   KEYCOMAND                   Cmd (command) key
   KEYCOPY                      Copy key
   KEYCREATE                    Create key
   KEYEND                       End key
   KEYEXIT                      Exit key
   KEYFIND                      Find key
   KEYHELP                      Help key
   KEYMARK                      Mark key
   KEYMESAGE                   Message key
   KEYMOVE                      Move key
   KEYNEXT                      Next object key
   KEYOPEN                      Open key
   KEYOPTIONS                   Options key
   KEYPREVIOUS                  Previous object key
   KEYREDO                      Redo key
   KEYREFERENCE                 Reference key
   KEYREFRESH                   Refresh key
   KEYREPLACE                   Replace key
   KEYRESTART                   Restart key
   KEYRESUME                    Resume key
   KEYSAVE                      Save key
   KEYSBEG                      Shifted beginning key
   KEYSCANCEL                   Shifted cancel key
   KEYSCOMAND                  Shifted command key
   KEYSCOPY                     Shifted copy key
   KEYSCREATE                   Shifted create key
   KEYSDC                       Shifted delete char key
   KEYSDL                       Shifted delete line key
   KEYSELECT                    Select key
   KEYSEND                      Shifted end key
   KEYSEOL                      Shifted clear line key
   KEYSEXIT                     Shifted exit key
   KEYSFIND                     Shifted find key
   KEYSHELP                     Shifted help key
   KEYSHOME                     Shifted home key
   KEYSIC                       Shifted input key
   KEYSLEFT                     Shifted left arrow key
   KEYSMESAGE                  Shifted message key



SunOS 5.11          Last change: 31 Dec 1996                    3






Curses Library Functions                      cursgetch(3CURSES)



   KEYSMOVE                     Shifted move key
   KEYSNEXT                     Shifted next key
   KEYSOPTIONS                  Shifted options key
   KEYSPREVIOUS                 Shifted prev key
   KEYSPRINT                    Shifted print key
   KEYSREDO                     Shifted redo key
   KEYSREPLACE                  Shifted replace key
   KEYSRIGHT                    Shifted right arrow
   KEYSRSUME                    Shifted resume key
   KEYSAVE                     Shifted save key
   KEYSUSPEND                  Shifted suspend key
   KEYSUNDO                     Shifted undo key
   KEYSUSPEND                   Suspend key
   KEYUNDO                      Undo key


RETURN VALUES
     All routines return  the  integer  ER  upon  failure.   The
     ungetch()  routine  returns  an integer value other than ER
     upon successful completion.  The other routines  return  the
     next  input  character  or function key code upon successful
     completion.

ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     MT-Level                     Unsafe                      
    


SEE ALSO
     cursinopts(3CURSES),                    cursmove(3CURSES),
     cursrefresh(3CURSES), curses(3CURSES), attributes(5)

NOTES
     The header   automatically  includes  the  headers
      and .


     Use of the escape key for a  single  character  function  is
     discouraged.


     When using getch(), wgetch(), mvgetch(), or mvwgetch(), noc-
     break  mode  (nocbreak()) and  echo mode (echo()) should not
     be used at the same time. Depending on the state of the  tty



SunOS 5.11          Last change: 31 Dec 1996                    4






Curses Library Functions                      cursgetch(3CURSES)



     driver when each character is typed, the program may produce
     undesirable results.


     Note that getch(), mvgetch(), and mvwgetch() may be macros.


















































SunOS 5.11          Last change: 31 Dec 1996                    5



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™