Category:Curses: Difference between revisions

From Rosetta Code
Content added Content deleted
m (This might format better.)
Line 13: Line 13:
* '''C''' <lang c>#include <curses.h></lang> Then link the program with <code>-lcurses</code>. (Some old or strange systems might need <code>-lcurses -ltermlib</code>.)
* '''C''' <lang c>#include <curses.h></lang> Then link the program with <code>-lcurses</code>. (Some old or strange systems might need <code>-lcurses -ltermlib</code>.)
* '''Ruby''' <lang ruby>require 'curses'</lang>
* '''Ruby''' <lang ruby>require 'curses'</lang>

[[Category:Terminal Control]]

Revision as of 19:44, 22 August 2011

Library
This is an example of a library. You may see a list of other libraries used on Rosetta Code at Category:Solutions by Library.

Curses is a library to draw characters on a terminal. Programs can use curses to move the terminal's cursor and display text in any line and column. For input, curses can get individual key presses from the terminal's keyboard. To optimize output, curses delays the screen updates until the program refreshes the screen.

There are at least 4 implementations of curses:

Curses is terminal-independent, and uses termcap or terminfo to send escape sequences to different flavors of terminals. (The exception is PDCurses, which never sends escape sequences, because it uses a DOS console or a graphical interface.)

  • C <lang c>#include <curses.h></lang> Then link the program with -lcurses. (Some old or strange systems might need -lcurses -ltermlib.)
  • Ruby <lang ruby>require 'curses'</lang>