ncurses is a C API that helps us in creating text based user interfaces in a terminal-independent manner. It is a free software emulation of curses in System V.
PDCurses is a public domain implementation of the curses library for DOS, Win32, OS/2, X11 platforms. Installation procedure is given below.
1. Install latest GCC (>=v4.7.2). Download it from equation.com and follow the installation instructions. Let's say GCC is installed into D:\gcc4.7.2
directory.
2. Download pdc34dllw.zip
or newer from sourceforge.net. For direct link click here.
3. Extract pdcurses.dll
to "D:\gcc4.7.2\libexec\gcc\i686-pc-mingw32\4.7.2"
directory.
4. Extract pdcurses.lib
to "D:\gcc4.7.2\i686-pc-mingw32\lib"
directory.
5. Extract curses.h
and panel.h
to "D:\gcc4.7.2\i686-pc-mingw32\include"
directory.
6. Ensure that proper environment variables and path variables are set. The path must be added to the front of the other path variables so that it takes precedence.
EQ_LIBRARY_PATH
d:\gcc4.7.2\i686-pc-mingw32\lib
PATH
d:\gcc4.7.2\bin;
d:\gcc4.7.2\libexec\gcc\i686-pc-mingw32\4.7.2;
7. Run the sample program to see if it prints "Hello World from PDCurses!" in the command prompt.
// hello.c
#include <curses.h>
int main() {
initscr(); // Start curses mode
printw("Hello World from PDCurses!"); // Print Hello World
refresh(); // Print it on to the real screen
getch(); // Wait for user input
endwin(); // End curses mode
return 0;
}
/* ---------------------------------------
> gcc -Wall -g -lpdcurses -o hello hello.c
> hello.exe
-----------------------------------------*/
8. To run the executable the pdcurses.dll
library is required. So if we are to bundle the app, ensure that the pdcurses.dll
file is also included along with the executable.
To know more about ncurses see ncurses programming howto, Programmer's Guide to NCurses by Dan Gookin.