I made a wrapper for the curses library except for that when i test it, it segfaults
it was compiled with gcc4.3.3 and ncurses5.7 on a ubuntu 9.04 system

here is my code:

main.cpp:
Code:
#include "./include/ncurses/ncurses.h"

int main()
{
	nCurses out;
	out << "Testing 123...\n";
	out.refresh();

	return 0;
}
./include/ncurses/ncurses.h:
Code:
#ifndef _NCURSES_H_
#define _NCURSES_H_

#include <curses.h>
#include <string>
using namespace std;

struct term_s{
	int row;
	int col;
};

class nCurses
{
	public:
		// constructors and deconstructors
		nCurses();
		nCurses(bool echo);
		nCurses(bool echo, int row, int col);
		nCurses(bool echo, int row, int col, int height, int width);
		~nCurses();

		// streaming functions
		friend const nCurses& operator << (nCurses& n, const char* c);

		// functions to get the private data
		bool getechostatus() const;
		int geterrno() const;
		term_s getcurpos() const;
		term_s getwinsize() const;

		// misc functions
		int echo(bool echo); // control echoing of input characters
		int cursor(int row, int col); // move the virtual cursor
		int refresh(); // refresh the screen from the buffer

	private:
		void init();
		bool echostatus; // contains if echo is on or off
		int errno; // maintains the errno (ERR or !ERR) of the latest function

		term_s winsize; // contains the current cursor postion and the terminal size

		WINDOW* window; // the virtual window that functions write to

		static bool ncurses_started; // monitors if ncurses has been started
		static int nCurses_count; // keeps a count of how many nCurses objects have been constructed
};

#endif
./include/ncurses/ncurses.cpp:
Code:
#include "ncurses.h"

/* init the static variables */
bool nCurses::ncurses_started = false;
int nCurses::nCurses_count = 0;

/* init some variables */
void nCurses::init()
{
	if (ncurses_started == false)
	{
		initscr();
		ncurses_started = true;
	}
	getmaxyx(stdscr, winsize.row, winsize.col);
}

/* constructors and deconstructors */
nCurses::nCurses()
{
	init();
	nCurses(false, 0, 0, winsize.row, winsize.col);
}

nCurses::nCurses(bool echo)
{
	init();
	nCurses(echo, 0, 0, winsize.row, winsize.col);
}

nCurses::nCurses(bool echo, int row, int col)
{
	init();
	nCurses(false, row, col, winsize.row, winsize.col);
}

nCurses::nCurses(bool echo, int row, int col, int height, int width) : echostatus(echo)
{
	nCurses_count++;
	init();
	window = newwin(height, width, row, col);
	keypad(window, TRUE);
	cbreak();
	if (echo == false)
	{
		errno = noecho();
		if (errno == ERR)
			echostatus = true;
	}
	cursor(row, col);
}

nCurses::~nCurses()
{
	nCurses_count--;
	delwin(window);
	if (nCurses_count <= 0)
	{
		endwin();
	}
}

/* streaming functions */
const nCurses& operator << (nCurses& n, const char* c)
{
	n.errno = waddstr(n.window, c);
	return n;
}

/* functions to get the private data */
bool nCurses::getechostatus() const
{
	return echostatus;
}

int nCurses::geterrno() const
{
	return errno;
}

term_s nCurses::getcurpos() const
{
	term_s curpos;
	getyx(window, curpos.row, curpos.col);
	return curpos;
}

term_s nCurses::getwinsize() const
{
	return winsize;
}

/* misc functions */
int nCurses::echo(bool echo)
{
	if ((echo == true) && (echostatus != true))
	{
		errno = ::echo();
		if (errno != ERR)
			echostatus = true;
	}
	else if ((echo == false) && (echostatus != false))
	{
		errno = noecho();
		if (noecho() != ERR)
			echostatus = false;
	}
	return errno;
}

int nCurses::cursor(int row, int col)
{
	errno = wmove(window, row, col);
	return errno;
}

int nCurses::refresh()
{
	errno = wrefresh(window);
	return errno;
}