Console programs in Linux often use the Curses library to display colourful and attractive user interfaces even when running in a terminal. I wanted to use something similar for the display of a Windows console utility I am writing in Pelles C. The program processes large data files and can take a while to complete, so it is useful to show progress as the program is working.
Pelles C has a CONIO library similar to the one I remember from Turbo Pascal years ago, but I wanted something that would still work if I need to use a different compiler in future. Plus I’ve always been impressed by what is possible with Curses and wanted to give it a go as a learning exercise.
There are several implementations of Curses for use with Windows but I am using PDCurses.
Start by downloading the file pdc34dllw.zip.
The ZIP should contain 4 files:
-
Copy the files curses.h and panel.h into C:\Program Files\PellesC\Include
-
Copy the pdcurses.lib file into C:\Program Files\PellesC\Lib
-
Create a new console project in Pelles C and copy the pdcurses.dll file into the project folder
At the top of your C program, add the following 2 lines:
#include <curses.h>
#pragma comment(lib, "pdcurses.lib")
You can now add code to your program to use the Curses functions.
All of the functions available are described in the PDCurses documentation and I also suggest you check out the NCurses documentation as it is very comprehensive and mostly applies equally to PDCurses. If you are not familiar with programming using Curses, have a look at the NCURSES Programming HOWTO to get started.
Here is a screenshot of my test program as an example:

At the top of the screen is a header that shows the program name and version, the input filename and a count of the lines processed so far. Underneath, the main part of the screen is used to show scrolling text as the process is working.
Download my example program cursetest.c if you want to give it a try.