inch, mvinch, mvwinch, or winch Subroutine

Purpose

Inputs a single-byte character and rendition from a window.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>
chtype inch(void);
chtype mvinch(int y,
int x);

chtype mvwinch(WINDOW  *win,
int y,
int x);
chtype winch(WINDOW *win);

Description

The inch, winch, mvinch, and mvwinch subroutines return the character and rendition, of type chtype, at the current or specified position in the current or specified window.

Parameters

Item Description
*win Specifies the window from which to get the character.
x  
y  

Return Values

Upon successful completion, these subroutines return the specified character and rendition. Otherwise, they return (chtype) ERR.

Examples

  1. To get the character at the current cursor location in the stdscr, enter:
    chtype character;
     
    character = inch();
  2. To get the character at the current cursor location in the user-defined window my_window, enter:
    WINDOW *my_window;
    chtype character;
     
    character = winch(my_window);
  3. To move the cursor to the coordinates y = 0, x = 5 and then get that character, enter:
    chtype character;
     
    character = mvinch(0, 5);
  4. To move the cursor to the coordinates y = 0, x = 5 in the user-defined window my_window and then get that character, enter:
    WINDOW *my_window;
    chtype character;
     
    character = mvwinch(my_window, 0, 5);