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

Technical Reference: Base Operating System and Extensions, Volume 2

addnstr, addstr, mvaddnstr, mvaddstr, mvwaddnstr, mvwaddstr, waddnstr, or waddstr Subroutine

Purpose

Adds a string of multi-byte characters without rendition to a window and advances the cursor.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

int addnstr(const char *str,
int n);

int addstr(const char *str); 

int mvaddnstr(int y,
int x,
const char *str,
int n);

int mvaddstr(int y,
int x,
const char *str);

int mvwaddnstr(WINDOW *win,
int y,
int x,
const char *str,
int n);

int mvwaddstr(WINDOW *win,
int y,
int x,
const char *str);

int waddnstr(WINDOW *win,
const char *str,
int n);

int waddstr(WINDOW *win,
const char *str); 

Description

These subroutines write the characters of the string str on the current or specified window starting at the current or specified position using the background rendition.

These subroutines advance the cursor position, perform special character processing, and perform wrapping.

The addstr, mvaddstr, mvwaddstr and waddstr subroutines are similar to calling mbstowcs on str, and then calling addwstr, mvaddwstr, mvwaddwstr, and waddwstr, respectively.

The addnstr, mvaddnstr, mvwaddnstr and waddnstr subroutines use at most, n bytes from str. These subroutines add the entire string when n is -1.

Parameters

Column Specifies the horizontal position to move the cursor to before adding the string.
Line Specifies the vertical position to move the cursor to before adding the string.
String Specifies the string to add.
Window Specifies the window to add the string to.

Return Values

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

Examples

  1. To add the string represented by xyz to the stdscr at the current cursor location, enter:
    char *xyz;
    xyz="Hello!";
    addstr(xyz);
  2. To add the "Hit a Key" string to the stdscr at the coordinates y=10, x=5, enter:
    mvaddstr(10, 5, "Hit a Key");
  3. To add the xyz string to the user-defined window my_window at the coordinates y=10, x=5, enter:
    mvwaddstr(my_window, 10, 5, "xyz");
  4. To add the xyz string to the user-defined string at the current cursor location, enter:
    waddstr(my_window, "xyz");

Related Information

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

Curses Overview for Programming in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

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

Manipulating Characters with Curses in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

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