ncurses window problem

This is a discussion on ncurses window problem within the Linux Programming forums, part of the Platform Specific Boards category; I encountered a problem while I read about using "windows" with ncurses library. When I tried to create a simple ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    131

    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.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    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.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Winamp Vis if anyone can help
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-26-2002, 11:43 PM

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