The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


putp, tputs - output commands to the terminal


#include <term.h>

int putp(const char *str);

int tputs(const char *str, int affcnt, int (*putfunc)(int));


These functions output commands contained in the terminfo database to the terminal.

The putp() function is equivalent to tputs(str, 1, putchar). The output of putp() always goes to stdout, not to the fildes specified in setupterm().

The tputs() function outputs str to the terminal. The str argument must be a terminfo string variable or the return value from tgetstr(), tgoto(), tigetstr() or tparm(). The affcnt argument is the number of lines affected, or 1 if not applicable. If the terminfo database indicates that the terminal in use requires padding after any command in the generated string, tputs() inserts pad characters into the string that is sent to the terminal, at positions indicated by the terminfo database. The tputs() function outputs each character of the generated string by calling the user-supplied function putfunc (see below).

The user-supplied function putfunc (specified as an argument to tputs()) is either putchar() or some other function with the same prototype. The tputs() function ignores the return value of putfunc.


Upon successful completion, these functions return OK. Otherwise, they return ERR.


No errors are defined.


Changing the terminal attributes using these functions may cause the renditions of characters within a curses window to be altered on some terminals.

After use of any of these functions, the model Curses maintains of the state of the terminal might not match the actual state of the terminal. The application should touch and refresh the window before resuming conventional use of Curses.


doupdate(), is_linetouched(), putchar() (in the XSH specification), tgetent(), tigetflag(), <term.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]