Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

clrtoeol(3cur)

inch(3cur)

scrollok(3cur)

standout(3cur)

putchar(3s)

addch(3cur)

Name

addch, waddch, mvaddch, mvwaddch − add character to window

Syntax

#include <cursesX.h>

int addch(ch)
chtype ch;

int waddch(win, ch)
WINDOW ∗win;
chtype ch;

int mvaddch(y, x, ch)
int y, x;
chtype ch;

int mvwaddch(win, y, x, ch)
WINDOW ∗win;
int y, x;
chtype ch;

Description

The routine addch inserts the character ch into the default window at the current cursor position and the window cursor is advanced. The character is of the type chtype which is defined in the <cursesX.h> header file, as containing both data and attributes.

The routine waddch inserts the character ch into the specified window at the current cursor position. The cursor position is advanced.

The routine mvaddch moves the cursor to the specified (y, x) position and inserts the character ch into the default window. The cursor position is advanced after the character has been inserted.

The routine mvwaddch moves the cursor to the specified (y, x) position and inserts the character ch into the specified window. The cursor position is advanced after the character has been inserted.

All these routines are similar to putchar. The following information applies to all the routines.

If the cursor moves on to the right margin, an automatic newline is performed.  If scrollok is enabled, and a character is added to the bottom right corner of the screen, the scrolling region will be scrolled up one line. If scrolling is not allowed, ERR will be returned.

If ch is a tab, newline, or backspace, the cursor will be moved appropriately within the window. If ch is a newline, the clrtoeol routine is called before the cursor is moved to the beginning of the next line. If newline mapping is off, the cursor will be moved to the next line, but the x coordinate will be unchanged. If ch is a tab the cursor is moved to the next tab position within the window. If ch is another control character, it will be drawn in the ^X notation. Calling the inch routine after adding a control character returns the representation of the control character, not the control character.

Video attributes can be combined with a character by or-ing them into the parameter.  This will result in these attributes being set.  The intent here is that text, including attributes, can be copied from one place to another using inch and addch. For further information, see standout(.).

The addch, mvaddch, and mvwaddch routines are macros.

Return Values

The addch, waddch, mvaddch, and mvwaddch functions return OK on success and ERR on error.

See Also

clrtoeol(3cur), inch(3cur), scrollok(3cur), standout(3cur), putchar(3s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026