2 <BODY BGCOLOR="#99ccbb" TEXT="#000000" LINK="#4060b0" VLINK="#000080" ALINK="#ff4040">
4 <STRONG>refresh</STRONG>, <STRONG>wrefresh</STRONG>, <STRONG>wnoutrefresh</STRONG>, <STRONG>doupdate</STRONG>, <STRONG>redrawwin</STRONG>, <STRONG>wre-</STRONG>
5 <STRONG>drawln</STRONG> - refresh <STRONG>curses</STRONG> windows and lines
10 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
12 <STRONG>int</STRONG> <STRONG>refresh(void);</STRONG>
13 <STRONG>int</STRONG> <STRONG>wrefresh(WINDOW</STRONG> <STRONG>*win);</STRONG>
14 <STRONG>int</STRONG> <STRONG>wnoutrefresh(WINDOW</STRONG> <STRONG>*win);</STRONG>
15 <STRONG>int</STRONG> <STRONG>doupdate(void);</STRONG>
16 <STRONG>int</STRONG> <STRONG>redrawwin(WINDOW</STRONG> <STRONG>*win);</STRONG>
17 <STRONG>int</STRONG> <STRONG>wredrawln(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>beg_line,</STRONG> <STRONG>int</STRONG> <STRONG>num_lines);</STRONG>
21 <H2>DESCRIPTION</H2><PRE>
22 The <STRONG>refresh</STRONG> and <STRONG>wrefresh</STRONG> routines (or <STRONG>wnoutrefresh</STRONG> and
23 <STRONG>doupdate</STRONG>) must be called to get actual output to the ter-
24 minal, as other routines merely manipulate data struc-
25 tures. The routine <STRONG>wrefresh</STRONG> copies the named window to
26 the physical terminal screen, taking into account what is
27 already there in order to do optimizations. The <STRONG>refresh</STRONG>
28 routine is the same, using <STRONG>stdscr</STRONG> as the default window.
29 Unless <STRONG>leaveok</STRONG> has been enabled, the physical cursor of
30 the terminal is left at the location of the cursor for
33 The <STRONG>wnoutrefresh</STRONG> and <STRONG>doupdate</STRONG> routines allow multiple
34 updates with more efficiency than <STRONG>wrefresh</STRONG> alone. In
35 addition to all the window structures, <STRONG>curses</STRONG> keeps two
36 data structures representing the terminal screen: a physi-
37 cal screen, describing what is actually on the screen, and
38 a virtual screen, describing what the programmer wants to
41 The routine <STRONG>wrefresh</STRONG> works by first calling <STRONG>wnoutrefresh</STRONG>,
42 which copies the named window to the virtual screen, and
43 then calling <STRONG>doupdate</STRONG>, which compares the virtual screen
44 to the physical screen and does the actual update. If the
45 programmer wishes to output several windows at once, a
46 series of calls to <STRONG>wrefresh</STRONG> results in alternating calls
47 to <STRONG>wnoutrefresh</STRONG> and <STRONG>doupdate</STRONG>, causing several bursts of
48 output to the screen. By first calling <STRONG>wnoutrefresh</STRONG> for
49 each window, it is then possible to call <STRONG>doupdate</STRONG> once,
50 resulting in only one burst of output, with fewer total
51 characters transmitted and less CPU time used. If the <EM>win</EM>
52 argument to <STRONG>wrefresh</STRONG> is the global variable <STRONG>curscr</STRONG>, the
53 screen is immediately cleared and repainted from scratch.
55 The phrase "copies the named window to the virtual screen"
56 above is ambiguous. What actually happens is that all
57 <EM>touched</EM> (changed) lines in the window are copied to the
58 virtual screen. This affects programs that use overlap-
59 ping windows; it means that if two windows overlap, you
60 see the section on <STRONG>PORTABILITY</STRONG> below for a warning about
61 exploiting this behavior.)
63 The <STRONG>wredrawln</STRONG> routine indicates to <STRONG>curses</STRONG> that some screen
64 lines are corrupted and should be thrown away before any-
65 thing is written over them. It touches the indicated
66 lines (marking them changed). The routine <STRONG>redrawwin</STRONG>()
67 touches the entire window.
71 <H2>RETURN VALUE</H2><PRE>
72 Routines that return an integer return <STRONG>ERR</STRONG> upon failure,
73 and <STRONG>OK</STRONG> (SVr4 only specifies "an integer value other than
74 <STRONG>ERR</STRONG>") upon successful completion.
79 Note that <STRONG>refresh</STRONG> and <STRONG>redrawwin</STRONG> may be macros.
83 <H2>PORTABILITY</H2><PRE>
84 The XSI Curses standard, Issue 4 describes these func-
87 Whether <STRONG>wnoutrefresh()</STRONG> copies to the virtual screen the
88 entire contents of a window or just its changed portions
89 has never been well-documented in historic curses versions
90 (including SVr4). It might be unwise to rely on either
91 behavior in programs that might have to be linked with
92 other curses implementations. Instead, you can do an
93 explicit <STRONG>touchwin()</STRONG> before the <STRONG>wnoutrefresh()</STRONG> call to
94 guarantee an entire-contents copy anywhere.
98 <H2>SEE ALSO</H2><PRE>
99 <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>, <STRONG><A HREF="curs_outopts.3x.html">curs_outopts(3X)</A></STRONG>