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

Technical Reference: Base Operating System and Extensions , Volume 2

mvcur Subroutine


Output cursor movement commands to the terminal.


Curses Library (libcurses.a)


#include <curses.h>
int mvcur(int oldrow,
int oldcol,
int newrow,
int newcol);


The mvcur subroutine outputs one or more commands to the terminal that move the terminal's cursor to (newrow, newcol), an absolute position on the terminal screen. The (oldrow, oldcol) arguments specify the former cursor position. Specifying the former position is necessary on terminals that do not provide coordinate-based movement commands. On terminals that provide these commands, Curses may select a more efficient way to move the cursor based on the former position. If (newrow, newcol) is not a valid address for the terminal in use, the mvcur subroutine fails. If (oldrow, oldcol) is the same as (newrow, newcol), mvcur succeeds without taking any action. If mvcur outputs a cursor movement command, it updates its information concerning the location of the cursor on the terminal.



Return Values

Upon successful completion, the mvcur subroutine returns OK. Otherwise, it returns ERR.


  1. To move the physical cursor from the coordinates y = 5, x = 15 to y = 25, x = 30, use:

    mvcur(5, 15, 25, 30);
  2. To move the physical cursor from unknown coordinates to y = 5, x = 0, use:

    mvcur(50, 50, 5, 0);

    In this example, the physical cursor's current coordinates are unknown. Therefore, arbitrary values are assigned to the OldLine and OldColumn parameters and the desired coordinates are assigned to the NewLine and NewColumn parameters. This is called an absolute move.

Implementation Specifics

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

Related Information

The doupdate (doupdate, refresh, wnoutrefresh, or wrefresh Subroutines) subroutine, is_linetouched (is_linetouched, is_wintouched, touchline, touchwin, untouchwin, or wtouchin Subroutine) subroutine, move (move or wmove Subroutine) subroutine, refresh (refresh or wrefresh Subroutine) subroutine.

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

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