[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


printw, wprintw, mvprintw, or mvwprintw Subroutine

Purpose

Performs a printf command on a window using the specified format control string.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>


printw( Format, [ Argument ...])
char *Format, *Argument;


wprintw( Window, Format, [Argument ...])
WINDOW *Window;
char *Format, *Argument;


mvprintw( Line, Column, Format, [Argument ...])
int Line, Column;
char *Format, *Argument;

mvwprintw(Window, Line, Column, Format, [Argument ...])
 
WINDOW *Window;
int Line, Column;
char *Format, *Argument; 

Description

The printw, wprintw, mvprintw, and mvwprintw subroutines perform output on a window by using the specified format control string. However, the waddch (addch, mvaddch, mvwaddch, or waddch Subroutine) subroutine is used to output characters in a given window instead of invoking the printf subroutine. The mvprintw and mvwprintw subroutines move the logical cursor before performing the output.

Use the printw and mvprintw subroutines on the stdscr and the wprintw and mvwprintw subroutines on user-defined windows.

Note: The maximum length of the format control string after expansion is 512 bytes.

Parameters


Argument Specifies the item to print. See the printf subroutine for more details.
Column Specifies the horizontal position to move the cursor to before printing.
Format Specifies the format for printing the Argument parameter. See the printf subroutine.
Line Specifies the vertical position to move the cursor to before printing.
Window Specifies the window to print into.

Examples

  1. To print the user-defined integer variables x and y as decimal integers in the stdscr, enter:

    int x, y;
    printw("%d%d", x, y);
    
  2. To print the user-defined integer variables x and y as decimal integers in the user-defined window my_window, enter:

    int x, y;
    WINDOW *my_window;
    wprintw(my_window, "%d%d", x, y);
    
  3. To move the logical cursor to the coordinates y = 5, x = 10 before printing the user-defined integer variables x and y as decimal integers in the stdscr, enter:

    int x, y;
    mvprintw(5, 10, "%d%d", x, y);
    
  4. To move the logical cursor to the coordinates y = 5, x = 10 before printing the user-defined integer variables x and y as decimal integers in the user-defined window my_window, enter:

    int x, y;
    WINDOW *my_window;
    mvwprintw(my_window, 5, 10, "%d%d", x, y);
    

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The waddch (addch, mvaddch, mvwaddch, or waddch Subroutine) subroutine, printf subroutine.

The printf command.

Curses Overview for Programming, List of Curses Subroutines, Manipulating Characters with Curses in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]