[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

putp, tputs Subroutine


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.



Return Values

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;

For the tputs subroutine:

  1. To output the clear screen sequence using the user-defined putchar-like subroutine my_putchar, enter:
    tputs(clear_screen, 1 ,my_putchar);
  2. To output the escape sequence used to move the cursor to the coordinates x=40 , y=18 through the user-defined putchar-like subroutine my_putchar , enter:
    tputs(tparm(cursor_address, 18, 40), 1, my_putchar);

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The doupdate, is_linetouched, putchar, tgetent, tigetflag, tputs subroutines.

Curses Overview for Programming in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

List of Curses Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

Understanding Terminals with Curses in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.

[ Previous | Next | Contents | Glossary | Home | Search ]