Outputs commands to the terminal.
Curses Library (libcurses.a)
#include <curses.h>
int putp(const char *str);
int tputs(const char *str,
int affcnt,
int (*putfunc)(int));
These subroutines output commands contained in the terminfo database to the terminal.
The putp subroutine is equivalent to tputs(str, 1, putchar). The output of the putp subroutine always goes to stdout, not to the fildes specified in the setupterm subroutine.
The tputs subroutine outputs str to the terminal. The str argument must be a terminfo string variable or the return value from the tgetstr, tgoto, tigestr, or tparm subroutines. 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, the tputs subroutine inserts pad characters into the string that is sent to the terminal, at positions indicated by the terminfo database. The tputs subroutine outputs each character of the generated string by calling the user-supplied putfunc subroutine (see below).
The user-supplied putfunc subroutine (specified as an argument to the tputs subroutine is either putchar or some other subroutine with the same prototype. The tputs subroutine ignores the return value of the putfunc subroutine.
Item | Description |
---|---|
*str | |
affcnt | |
*putfunc |
Upon successful completion, these subroutines return OK. Otherwise, they return ERR.
For the putp subroutine:
To call the tputs(my_string, 1, putchar) subroutine, enter:
char *my_string;
putp(my_string);
For the tputs subroutine:
int_my_putchar();
tputs(clear_screen, 1 ,my_putchar);
int_my_putchar();
tputs(tparm(cursor_address, 18, 40), 1, my_putchar);