Debugging PDcurses

Hello everyone. So I just started getting back into C++ and programming after a good 2+ year break and need some help getting a simple 'hello world' program to work in PDcurses.

When I run the program the window comes up and displays my message, and then a message box comes up saying how it stopped working. Cool. So I used the debug option ( I'm on MS Visual Studio Express 2013 ) and I get the message:

Unhandled exception at 0x100027B4 (pdcurses.dll) in Test001.exe: 0xC0000005: Access violation reading location 0x9168263F.

After playing around a bit I got it narrowed it down to the line with the getch() function. In addition that same function is purple in the code. I have no idea what it means but I hope somebody else does. I did a bit of searching on Google but couldn't find anything relevant.

1
2
3
4
5
6
7
8
9
10
11
12
#include <curses.h>

int main()
{
	initscr();			/* Start curses mode 		  */
	printw("Hello World !!!");	/* Print Hello World		  */
	refresh();			/* Print it on to the real screen */
	getch();			/* Wait for user input */
	endwin();			/* End curses mode		  */

	return 0;
}
Don't know anything about curses...

Access violation errors occur in various situations where the the program will try to read the data from a variable that is not there.
Ex: Trying to use a NULL pointer or reading element x in array[x] when there is no element x.

In your case I'm not sure exactly how getch is incompatible with curses...
Perhaps try an alternative way to pause the screen ?
There are many (and better) ways to do it.
Last edited on
i think the getch() is now _getch()
getch() is part of the curses library so it should work. I have no idea why it doesn't.
Topic archived. No new replies allowed.