]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_addstr.3x
ncurses 6.4 - patch 20231007
[ncurses.git] / man / curs_addstr.3x
1 .\"***************************************************************************
2 .\" Copyright 2019-2022,2023 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.35 2023/10/07 21:19:07 tom Exp $
31 .TH curs_addstr 3X 2023-10-07 "ncurses 6.4" "Library calls"
32 .ie \n(.g \{\
33 .ds `` \(lq
34 .ds '' \(rq
35 .\}
36 .el \{\
37 .ie t .ds `` ``
38 .el   .ds `` ""
39 .ie t .ds '' ''
40 .el   .ds '' ""
41 .\}
42 .
43 .de bP
44 .ie n  .IP \(bu 4
45 .el    .IP \(bu 2
46 ..
47 .SH NAME
48 \fB\%addstr\fP,
49 \fB\%addnstr\fP,
50 \fB\%waddstr\fP,
51 \fB\%waddnstr\fP,
52 \fB\%mvaddstr\fP,
53 \fB\%mvaddnstr\fP,
54 \fB\%mvwaddstr\fP,
55 \fB\%mvwaddnstr\fP \-
56 add a string to a \fIcurses\fR window and advance the cursor
57 .SH SYNOPSIS
58 .nf
59 \fB#include <curses.h>
60 .PP
61 \fBint addstr(const char *\fIstr\fP);
62 \fBint addnstr(const char *\fIstr\fP, int \fIn\fP);
63 \fBint waddstr(WINDOW *\fIwin\fP, const char *\fIstr\fP);
64 \fBint waddnstr(WINDOW *\fIwin\fP, const char *\fIstr\fP, int \fIn\fP);
65 .PP
66 \fBint mvaddstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP);
67 \fBint mvaddnstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP);
68 \fBint mvwaddstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP);
69 \fBint mvwaddnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP);
70 .fi
71 .SH DESCRIPTION
72 These functions write the (null-terminated) character string
73 \fIstr\fP on the given window.
74 It is similar to calling \fBwaddch\fP once for each byte in the string.
75 .PP
76 The \fImv\fP functions perform cursor movement once, before writing any
77 characters.
78 Thereafter, the cursor is advanced as a side-effect of writing to the window.
79 .PP
80 The four functions with \fIn\fP as the last argument
81 write at most \fIn\fP bytes,
82 or until a terminating null is reached.
83 If \fIn\fP is \-1, then the entire string will be added.
84 .SH RETURN VALUE
85 All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success.
86 .PP
87 X/Open does not define any error conditions.
88 This implementation returns an error
89 .bP
90 if the window pointer is null or
91 .bP
92 if the string pointer is null or
93 .bP
94 if the corresponding calls to \fBwaddch\fP return an error.
95 .PP
96 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
97 \fBwmove\fP, and return an error if the position is outside the window,
98 or if the window pointer is null.
99 If an error is returned by the \fBwmove\fP,
100 no characters are added to the window.
101 .PP
102 If an error is returned by \fBwaddch\fP
103 (e.g.,
104 because the window is not large enough,
105 or an illegal byte sequence was detected)
106 only part of the string may be added.
107 Aside from that,
108 there is a special case in \fBwaddch\fP where an error may be
109 returned after successfully writing a character to the lower-right corner
110 of a window when \fBscrollok\fP(3X) is disabled.
111 .SH NOTES
112 All of these functions except \fBwaddnstr\fP may be macros.
113 .SH PORTABILITY
114 These functions are described in the XSI Curses standard, Issue 4.
115 .SH SEE ALSO
116 \fB\%curses\fP(3X),
117 \fB\%curs_addch\fP(3X)