[Mono-list] Mono NCurses bindings

Florian Hester florian at nedlinux.nl
Sun Jun 18 18:14:08 EDT 2006


Hello,

I am trying to make NCurses bindings for Mono. I needed NCurses for my
project and AFAIK there arent any NCurses bindings for Mono. So i thought
why not make them myself.

I am using a simple C library i wrote myself. In which i wrap some of the
functions if needed. I then use the functions in C# using DllImport.

Its working great, i have some simple functions implemented, and i was
able to get a version of this example in C# working:
http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/scanw.html#GETSTREX

In C#:

class TestNC
{
	public static void Main (string[] args)
	{
		NCurses cur = new NCurses();
		string msg = "Enter a string: ";
		string str = "";
		int row,col;

		cur.InitScreen();
		row = cur.GetMaxY();
		col = cur.GetMaxX();
		cur.MVPrintW(row/2, (col-msg.Length)/2, msg);
		str = cur.GetStr();
		cur.MVPrintW(cur.GetLINES() - 2, 0, "You Entered: " + str);
		cur.GetCh();
		cur.EndWin();
	}
}

I dont know if i will be using classes. I will maybe stick to functions so
existing tutorials for NCurses in C are easy to use for C#.

You can download the example and bindings here:
http://home.nedlinux.nl/~florian/downloads/NCursesSharp.tar.gz

Florian Hester



More information about the Mono-list mailing list