Canul D wrote:
> Why dosn't this code snipet display anything?
> #include <curses.h>
> void main(void)
> {
> WINDOW *my;
> initscr();
> cbreak();
> my = newwin(12, 12, 12, 12);
> waddstr(my, "I can't understand why it dosn't want to work!\n");
> refresh();
> endwin();
> }
Two problems are occuring here:
First, you want to replace "refresh()", with "wrefresh(my)",
since you want to refresh the window pointer to by "my" and not
the standard screen.
Second, add a line such as "sleep(10)" to pause the screen for a few
seconds so that you have a chance to see it. Otherwise the window will be
refreshed, displayed, closed, and program ended before you even have
a chace to view it on screen.
Try the following:
#include <curses.h>
void main()
{
WINDOW *my;
initscr();
cbreak();
my = newwin(12, 12, 12, 12);
waddstr(my, "I can't understand why this doesn't work\n");
wrefresh(my); /* refresh window "my" */
sleep(10); /* pause 10 sec*/
endwin();
}
/John <[EMAIL PROTECTED]>
--
email: [EMAIL PROTECTED]
Local mailserver , remote