Help with Ncurses

From: Ankit (ankit42001_at_yahoo.com)
Date: 12/29/04

  • Next message: Martijn: "Re: Choice of data structure for large event queues?"
    Date: 28 Dec 2004 22:31:06 -0800
    
    

    hello everyone,

    Very recently i have come across the curses library available in
    Linux. well i was trying to make a few user interfaces and there was
    no problem

    i tried to accept some data from the user interface it worked fine
    except for one glitch, that is i cannot use the backspace key.

    whenever i use the backspace the character to the left is not deleted
    instead a new garbage value is displayed.

    i hope someone will help me solve this problem

    here is the code fragment.
    to compile: cc -lncurses filename.c
    Inorder to exit press 'x'

    #include<stdio.h>
    #include<curses.h>
    #include<panel.h>

    main()

    {
    char ch,buff[20];
    WINDOW *w1,*w2;
    int i=0;
    initscr();
    start_color();
    init_pair(1,COLOR_WHITE,COLOR_GREEN);

    w1=newwin(LINES,COLS,0,0);
    wstandend(w1);
    wbkgd(w1,COLOR_PAIR(1));
    wattron(w1,A_BOLD);
    wrefresh(w1);

    keypad(stdscr,TRUE);
    noecho();
    while((ch=wgetch(w1)) != 'x')
    {
    buff[i++] = ch;
    wechochar(w1,ch);
    wrefresh(w1);
    }
    mvwprintw(w1,2,4,buff);
    wrefresh(w1);
    }


  • Next message: Martijn: "Re: Choice of data structure for large event queues?"

    Relevant Pages

    • Re: Is This a KDE/Gnome Group?
      ... KDE and the like, clones of the Windows/Mac user interfaces, are ... On Windows and Mac systems, designed to be used by ignorant ... So they want to take over Linux. ...
      (comp.os.linux.setup)
    • Re: Switching to Linux? Not really! A Windows PC next to every Linux box!
      ... >> Could it be possible that the current GUI based user interfaces ... Linux actually turned out to be a rather interesting solution to this ... identical to the Windows desktops made it difficult for the casual ... observer to identify who was running which desktop. ...
      (comp.unix.solaris)