Category:Curses: Difference between revisions

From Rosetta Code
Content added Content deleted
m (code.google.com going away)
(Add installation instruction for the common lisp ncurses binding)
 
Line 12: Line 12:


* '''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>.)

* '''Common Lisp''' <lang lisp>;; After installing the quicklisp library manager
(ql:quickload :croatoan)</lang>

* '''Ruby''' <lang ruby>require 'curses'</lang>
* '''Ruby''' <lang ruby>require 'curses'</lang>

* '''Go''' <lang go>import "github.com/gbin/goncurses"</lang>There are a number of curses bindings for Go. This one is popular.
* '''Go''' <lang go>import "github.com/gbin/goncurses"</lang>There are a number of curses bindings for Go. This one is popular.



Latest revision as of 22:52, 28 February 2017

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.)
  • Common Lisp <lang lisp>;; After installing the quicklisp library manager

(ql:quickload :croatoan)</lang>

  • Ruby <lang ruby>require 'curses'</lang>
  • Go <lang go>import "github.com/gbin/goncurses"</lang>There are a number of curses bindings for Go. This one is popular.