C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-21-2007, 10:29 AM   #1
Registered User
 
Join Date: Jul 2007
Posts: 62
ncurses window problem

I encountered a problem while I read about using "windows" with ncurses library. When I tried to create a simple program using windows, it compiled well without any warnings, but window's borders don't show up in console. In some point I did something that made them flash (right now I don't have any idea about what I did), but after flashing once, they went away right away. I've tried to refresh it. Example programs in this tutorial don't work.

If someone wants, here's a simple example program.
Code:
#include <ncurses.h>

int main(void) {
        WINDOW *wp;

        initscr();

        wp = newwin(10, 10, 10, 10);
        box(wp, 0, 0);
        wprintw(wp, "foo");
        wrefresh(wp);

        endwin();
        return 0;
}
My OS is Gentoo Linux 2007.0. I'm using bash-3.1 and I've tried in ash-1.6. Compiler is gcc 4.1.1 and linker GNU ld-2.17. I have latest version of ncurses library. If someone needs more information, I can tell it.
fronty is offline   Reply With Quote
Old 09-21-2007, 10:45 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Well, there's nothing in your program that prevents it from exiting as soon as it's finished showing the window... So I expect it will flash up a window for brief moment and then take it down again.

Try putting a "getchar()" before your return in main().

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 09-21-2007, 11:07 AM   #3
Registered User
 
Join Date: Jul 2007
Posts: 62
Sorry, forgot it from that program. I've used it, but it doesn't work.
And a littele more specifing, I _can_ see text written in window, but I _can't_ see windows borders.
fronty is offline   Reply With Quote
Old 09-22-2007, 09:33 AM   #4
Registered User
 
Join Date: Jul 2007
Posts: 62
Okay. Got it working. First I noticed, that if I put getch(); after calling box() in function that I made to create windows and put frames in it, it showed borders. After that I noticed, that if I replaced that getch(); with refresh();, same thing happened and I didn't have to press any key.

Looks like this problem is pretty much solved.
fronty is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A question related to strcmp meili100 C++ Programming 6 07-07-2007 02:51 PM
OpenGL Window Morgul Game Programming 1 05-15-2005 12:34 PM
problem with open gl engine. gell10 Game Programming 1 08-21-2003 04:10 AM
Tab Controls - API -KEN- Windows Programming 7 06-02-2002 09:44 AM
Winamp Vis if anyone can help Unregistered Windows Programming 6 01-27-2002 12:43 AM


All times are GMT -6. The time now is 10:29 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22