doupdate, refresh, wnoutrefresh, or wrefresh Subroutines

Purpose

Refreshes windows and lines.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

int doupdate(void);

int refresh(void);

int wnoutrefresh(WINDOW  *win);

int wrefresh(WINDOW *win);

Description

The refresh and wrefresh subroutines refresh the current or specified window. The subroutines position the terminal's cursor at the cursor position of the window, except that, if the leaveok mode has been enabled, they may leave the cursor at an arbitrary position.

The wnoutrefresh subroutine determines which parts of the terminal may need updating.

The doupdate subroutine sends to the terminal the commands to perform any required changes.

Parameters

Item Description
*win Specifies the window to be refreshed.

Return Values

Upon successful completion, these subroutines return OK. Otherwise, they return ERR.

Examples

For the doupdate or wnoutrefresh subroutine:

To update the user-defined windows my_window1 and my_window2, enter:

WINDOW *my_window1, my_window2;
wnoutrefresh(my_window1);
wnoutrefresh(my_window2);
doupdate();

For the refresh or wrefresh subroutine:

  1. To update the terminal's display and the current screen structure to reflect changes made to the standard screen structure, use:
    refresh();
  2. To update the terminal and the current screen structure to reflect changes made to a user-defined window called my_window, use:
    WINDOW *my_window;
    wrefresh(my_window);
  3. To restore the terminal to its state at the last refresh, use:
    wrefresh(curscr);

This subroutine is useful if the terminal becomes garbled for any reason.