The Linux Curses Library

The Curses library is a very useful for graphical programming in Linux. The Linux Terminal is a very low level programming interface and any user who wanted to make a graphical program had to go through a lot of low level utilities, which made it necessary to have a library that would abstract the lower level details of the Terminal. Thus the Curses library was born.

The Curses library is halfway between the low level terminal and the high level GNOME/GTK+ and Qt/KDE interfaces. The library gets its name from its ability to optimize the movement of cursor and reduce the number of updates for the text based terminal.

The Curses routine works on windows, sub windows and screens. The Curses library maintains two data structures to maintain track of the screen. They are, stdscr and curses.stdscr, the more important of the two.

Curses makes Graphical Programming very easy. To check whether you have curses, enter the following commands in your terminal:

ls -l /usr/include/*curses.h

To look at the header files, type:

ls -l usr/include/lib*curses*

If these files are linked, then they can be executed using this command:

$ gcc program.c -o program -lcurses

Now, the following program is a simple “Hello World” program which displays basic concept about curses. Run it in your Linux Terminal and see the output.

int main()
printw("%s","Hello, World");



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s