📄 ncurses.3x.html
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><!-- * t **************************************************************************** * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * **************************************************************************** * @Id: ncurses.3x,v 1.70 2004/01/11 01:45:54 tom Exp @--><HTML><HEAD><TITLE>ncurses 3x</TITLE><link rev=made href="mailto:bug-ncurses@gnu.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD><BODY><H1>ncurses 3x</H1><HR><PRE><!-- Manpage converted by man2html 3.0.1 --><STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG></PRE><H2>NAME</H2><PRE> <STRONG>ncurses</STRONG> - CRT screen handling and optimization package</PRE><H2>SYNOPSIS</H2><PRE> <STRONG>#include</STRONG> <STRONG><curses.h></STRONG></PRE><H2>DESCRIPTION</H2><PRE> The <STRONG>ncurses</STRONG> library routines give the user a terminal- independent method of updating character screens with rea- sonable optimization. This implementation is ``new curses'' (ncurses) and is the approved replacement for 4.4BSD classic curses, which has been discontinued. The <STRONG>ncurses</STRONG> routines emulate the <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> library of System V Release 4 UNIX, and the XPG4 curses standard (XSI curses) but the <STRONG>ncurses</STRONG> library is freely redistributable in source form. Differences from the SVr4 curses are sum- marized under the EXTENSIONS and BUGS sections below and described in detail in the EXTENSIONS and BUGS sections of individual man pages. A program using these routines must be linked with the <STRONG>-lncurses</STRONG> option, or (if it has been generated) with the debugging library <STRONG>-lncurses_g</STRONG>. (Your system integrator may also have installed these libraries under the names <STRONG>-lcurses</STRONG> and <STRONG>-lcurses_g</STRONG>.) The ncurses_g library generates trace logs (in a file called 'trace' in the current direc- tory) that describe curses actions. The <STRONG>ncurses</STRONG> package supports: overall screen, window and pad manipulation; output to windows and pads; reading ter- minal input; control over terminal and <STRONG>curses</STRONG> input and output options; environment query routines; color manipu- lation; use of soft label keys; terminfo capabilities; and access to low-level terminal-manipulation routines. To initialize the routines, the routine <STRONG>initscr</STRONG> or <STRONG>newterm</STRONG> must be called before any of the other routines that deal with windows and screens are used. The routine <STRONG>endwin</STRONG> must be called before exiting. To get character-at-a-time input without echoing (most interactive, screen oriented programs want this), the following sequence should be used: <STRONG>initscr();</STRONG> <STRONG>cbreak();</STRONG> <STRONG>noecho();</STRONG> Most programs would additionally use the sequence: <STRONG>nonl();</STRONG> <STRONG>intrflush(stdscr,</STRONG> <STRONG>FALSE);</STRONG> <STRONG>keypad(stdscr,</STRONG> <STRONG>TRUE);</STRONG> Before a <STRONG>curses</STRONG> program is run, the tab stops of the ter- minal should be set and its initialization strings, if defined, must be output. This can be done by executing the <STRONG>tput</STRONG> <STRONG>init</STRONG> command after the shell environment variable <STRONG>TERM</STRONG> has been exported. <STRONG>tset(1)</STRONG> is usually responsible for doing this. [See <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for further details.] The <STRONG>ncurses</STRONG> library permits manipulation of data struc- tures, called <EM>windows</EM>, which can be thought of as two- dimensional arrays of characters representing all or part of a CRT screen. A default window called <STRONG>stdscr</STRONG>, which is the size of the terminal screen, is supplied. Others may be created with <STRONG>newwin</STRONG>. Note that <STRONG>curses</STRONG> does not handle overlapping windows, that's done by the <STRONG><A HREF="panel.3x.html">panel(3x)</A></STRONG> library. This means that you can either use <STRONG>stdscr</STRONG> or divide the screen into tiled win- dows and not using <STRONG>stdscr</STRONG> at all. Mixing the two will result in unpredictable, and undesired, effects. Windows are referred to by variables declared as <STRONG>WINDOW</STRONG> <STRONG>*</STRONG>. These data structures are manipulated with routines described here and elsewhere in the <STRONG>ncurses</STRONG> manual pages. Among which the most basic routines are <STRONG>move</STRONG> and <STRONG>addch</STRONG>. More general versions of these routines are included with names beginning with <STRONG>w</STRONG>, allowing the user to specify a window. The routines not beginning with <STRONG>w</STRONG> affect <STRONG>stdscr</STRONG>.) After using routines to manipulate a window, <STRONG>refresh</STRONG> is called, telling <STRONG>curses</STRONG> to make the user's CRT screen look like <STRONG>stdscr</STRONG>. The characters in a window are actually of type <STRONG>chtype</STRONG>, (character and attribute data) so that other information about the character may also be stored with each character. Special windows called <EM>pads</EM> may also be manipulated. These are windows which are not constrained to the size of the screen and whose contents need not be completely dis- played. See <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG> for more information. In addition to drawing characters on the screen, video attributes and colors may be supported, causing the char- acters to show up in such modes as underlined, in reverse video, or in color on terminals that support such display enhancements. Line drawing characters may be specified to be output. On input, <STRONG>curses</STRONG> is also able to translate arrow and function keys that transmit escape sequences into single values. The video attributes, line drawing characters, and input values use names, defined in <STRONG><curses.h></STRONG>, such as <STRONG>A_REVERSE</STRONG>, <STRONG>ACS_HLINE</STRONG>, and <STRONG>KEY_LEFT</STRONG>. If the environment variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> are set, or if the program is executing in a window environment, line and column information in the environment will override information read by <EM>terminfo</EM>. This would effect a program running in an AT&T 630 layer, for example, where the size of a screen is changeable (see <STRONG>ENVIRONMENT</STRONG>). If the environment variable <STRONG>TERMINFO</STRONG> is defined, any pro- gram using <STRONG>curses</STRONG> checks for a local terminal definition
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -