]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_addstr.3x
ncurses 6.2 - patch 20200725
[ncurses.git] / man / curs_addstr.3x
1 .\"***************************************************************************
2 .\" Copyright 2019,2020 Thomas E. Dickey                                     *
3 .\" Copyright 1998-2012,2017 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_addstr.3x,v 1.22 2020/03/22 00:06:42 tom Exp $
31 .TH curs_addstr 3X ""
32 .ie \n(.g .ds `` \(lq
33 .el       .ds `` ``
34 .ie \n(.g .ds '' \(rq
35 .el       .ds '' ''
36 .de bP
37 .ie n  .IP \(bu 4
38 .el    .IP \(bu 2
39 ..
40 .na
41 .hy 0
42 .SH NAME
43 \fBaddstr\fR,
44 \fBaddnstr\fR,
45 \fBwaddstr\fR,
46 \fBwaddnstr\fR,
47 \fBmvaddstr\fR,
48 \fBmvaddnstr\fR,
49 \fBmvwaddstr\fR,
50 \fBmvwaddnstr\fR \- add a string of characters to a \fBcurses\fR window and advance cursor
51 .ad
52 .hy
53 .SH SYNOPSIS
54 .nf
55 \fB#include <curses.h>\fR
56 .PP
57 \fBint addstr(const char *\fR\fIstr\fR\fB);\fR
58 .br
59 \fBint addnstr(const char *\fR\fIstr\fR\fB, int \fR\fIn\fR\fB);\fR
60 .br
61 \fBint waddstr(WINDOW *\fR\fIwin\fR\fB, const char *\fR\fIstr\fR\fB);\fR
62 .br
63 \fBint waddnstr(WINDOW *\fR\fIwin\fR\fB, const char *\fR\fIstr\fR\fB, int \fR\fIn\fR\fB);\fR
64 .br
65 \fBint mvaddstr(int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const char *\fR\fIstr\fR\fB);\fR
66 .br
67 \fBint mvaddnstr(int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const char *\fR\fIstr\fR\fB, int \fR\fIn\fR\fB);\fR
68 .br
69 \fBint mvwaddstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const char *\fR\fIstr\fR\fB);\fR
70 .br
71 \fBint mvwaddnstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const char *\fR\fIstr, int \fR\fIn\fR\fB);\fR
72 .fi
73 .SH DESCRIPTION
74 These functions write the (null-terminated) character string
75 \fIstr\fR on the given window.
76 It is similar to calling \fBwaddch\fR once for each byte in the string.
77 .PP
78 The \fImv\fR functions perform cursor movement once, before writing any
79 characters.
80 Thereafter, the cursor is advanced as a side-effect of writing to the window.
81 .PP
82 The four functions with \fIn\fR as the last argument
83 write at most \fIn\fR bytes,
84 or until a terminating null is reached.
85 If \fIn\fR is \-1, then the entire string will be added.
86 .SH RETURN VALUE
87 All functions return the integer \fBERR\fR upon failure and \fBOK\fR on success.
88 .PP
89 X/Open does not define any error conditions.
90 This implementation returns an error
91 .bP
92 if the window pointer is null or
93 .bP
94 if the string pointer is null or
95 .bP
96 if the corresponding calls to \fBwaddch\fP return an error.
97 .PP
98 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
99 \fBwmove\fP, and return an error if the position is outside the window,
100 or if the window pointer is null.
101 If an error is returned by the \fBwmove\fP,
102 no characters are added to the window.
103 .PP
104 If an error is returned by \fBwaddch\fP
105 (e.g.,
106 because the window is not large enough,
107 or an illegal byte sequence was detected)
108 only part of the string may be added.
109 Aside from that,
110 there is a special case in \fBwaddch\fP where an error may be
111 returned after successfully writing a character to the lower-right corner
112 of a window when \fBscrollok\fP is disabled.
113 .SH NOTES
114 All of these functions except \fBwaddnstr\fR may be macros.
115 .SH PORTABILITY
116 These functions are described in the XSI Curses standard, Issue 4.
117 .SH SEE ALSO
118 \fBcurses\fR(3X),
119 \fBcurs_addch\fR(3X).