Find the answer to your Linux question:
Results 1 to 4 of 4
Hi i am using ncurses to hide keyboard input: Code: initscr(); noecho(); char c = '

Thread: ncurses messes up terminal after program ends

'; while (c != 0x0d) { c = getchar(); printf("*");fflush(stdout); } echo(); works ok, but ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    18

    ncurses messes up terminal after program ends

    Hi
    i am using ncurses to hide keyboard input:
    Code:
      initscr(); 
      noecho();
    
      char c = '\0';
      while (c != 0x0d) {
        c = getchar(); 
        printf("*");fflush(stdout);
      }
      echo();
    works ok, but after the program ends, my terminal is messed up such that it
    does not echo keyboard input anymore. I first have to type 'reset' to have
    it work normally again. Is there any command i have to add which ends the
    settings of ncurses?

    Thank You
    Jody

  2. #2
    Linux Newbie
    Join Date
    Jan 2008
    Location
    UK
    Posts
    211
    Hi,
    If you want to initialize and reset curses use
    initscr();

    ....

    endwin();
    exit(EXIT_SUCCESS);

    hope this helps

  3. #3
    Linux Newbie
    Join Date
    Jan 2008
    Location
    UK
    Posts
    211
    Hi again,
    I've just been refreshing my mind as to curses and if you want to carry on in curses and reset it so it echos, use the keyboard input functions and it will be easy.

    hope this is more like what you had in mind.

    wowbag1

  4. #4
    Just Joined!
    Join Date
    Sep 2007
    Posts
    18

    [solved] ncurses messes up terminal after program ends

    Thanks wowbag1
    endwin() did the trick !

    Jody

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...