clear, erase, wclear or werase Subroutine
Purpose
Clears a window.
Library
Curses Library (libcurses.a)
Syntax
#include <curses.h>
int clear(void);
int erase(void);
int wclear(WINDOW *win);
int werase(WINDOW *win);
Description
The clear, erase, wclear, and werase subroutines clear every position in the current or specified window.
The clear and wclear subroutines also achieve the same effect as calling the clearok subroutine, so that the window is cleared completely on the next call to the wrefresh subroutine for the window and is redrawn in its entirety.
Parameters
Item | Description |
---|---|
*win | Specifies the window to clear. |
Return Values
Upon successful completion, these subroutines return OK. Otherwise, they return ERR.
Examples
For the clear and wclear subroutines:
- To clear stdscr and set a clear flag for the next call to the
refresh subroutine, enter:
clear();
- To clear the user-defined window my_window and set a
clear flag for the next call to the wrefresh subroutine, enter:
WINDOW *my_window; wclear(my_window); waddstr (my_window, "This will be cleared."); wrefresh (my_window);
- To erase the standard screen structure, enter:
erase();
- To erase the user-defined window my_window, enter:
WINDOW *my_window; werase (my_window);
Note: After the wrefresh, the window will be cleared completely. You will not see the string "This will be cleared."
For the erase and werase subroutines:
- To erase the standard screen structure, enter:
erase();
- To erase the user-defined window my_window, enter:
WINDOW *my_window; werase(my_window);