]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_print.3x
ncurses 6.4 - patch 20230923
[ncurses.git] / man / curs_print.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 Thomas E. Dickey                                *
3 .\" Copyright 1998-2010,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_print.3x,v 1.31 2023/09/23 23:04:49 tom Exp $
31 .TH curs_print 3X 2023-09-23 "ncurses 6.4" "Library calls"
32 .SH NAME
33 \fB\%mcprint\fP \-
34 write binary data to printer using \fIterminfo\fR capabilities
35 .SH SYNOPSIS
36 \fB#include <curses.h>\fP
37 .PP
38 \fBint mcprint(char *\fIdata\fB, int \fIlen\fB);\fR
39 .SH DESCRIPTION
40 This function uses the \fBmc5p\fP or \fBmc4\fP and \fBmc5\fP capabilities,
41 if they are present, to ship given data to a printer attached to the terminal.
42 .PP
43 Note that the \fB\%mcprint\fP code has no way to do flow control with the printer
44 or to know how much buffering it has.
45 Your application is responsible for
46 keeping the rate of writes to the printer below its continuous throughput rate
47 (typically about half of its nominal cps rating).
48 Dot-matrix printers and
49 6-page-per-minute lasers can typically handle 80cps, so a good conservative
50 rule of thumb is to sleep for a second after shipping each 80-character line.
51 .
52 .SH RETURN VALUE
53 The \fB\%mcprint\fP function returns \fBERR\fP if the write operation aborted
54 for some reason.
55 In this case, \fB\%errno\fP will contain either an error associated
56 with \fBwrite\fP(2) or one of the following:
57 .TP 5
58 \fBENODEV\fP
59 Capabilities for printer redirection do not exist.
60 .TP 5
61 \fBENOMEM\fP
62 Couldn't allocate sufficient memory to buffer the printer write.
63 .PP
64 When \fB\%mcprint\fP succeeds, it returns the number of characters actually
65 sent to the printer.
66 .SH PORTABILITY
67 The \fB\%mcprint\fP call was designed for \fIncurses\fP, and is not found
68 in SVr4 \fIcurses\fP, 4.4BSD \fIcurses\fP, or any other previous version of \fIcurses\fP.
69 It is recommended that any code depending on \fIncurses\fP extensions
70 be conditioned using \fB\%NCURSES_VERSION\fP.
71 .SH BUGS
72 Padding in the \fBmc5p\fP, \fBmc4\fP and \fBmc5\fP capabilities will not be
73 interpreted.
74 .SH SEE ALSO
75 \fB\%curses\fP(3X)