VMS Help  —  CRTL  [no]crmode
    In the UNIX system environment, the crmode and nocrmode functions
    set and unset the terminal from cbreak mode. In cbreak mode, a
    single input character can be processed without pressing Return.
    This mode of single-character input is only supported with the
    Curses input routine getch.

    Format

      #include  <curses.h>

      crmode()

      nocrmode()

1  –  Example

        /* Program to demonstrate the use of crmod() and curses */

        #include <curses.h>

        main()
        {
            WINDOW *win1;
            char vert = '.',
                 hor = '.',
                 str[80];

            /*  Initialize standard screen, turn echo off.  */
            initscr();
            noecho();

            /*  Define a user window.  */
            win1 = newwin(22, 78, 1, 1);

            /*  Turn on reverse video and draw a box on border.  */
            setattr(_REVERSE);
            box(stdscr, vert, hor);
            mvwaddstr(win1, 2, 2, "Test cbreak input");
            refresh();
            wrefresh(win1);

            /*  Set cbreak, do some input, and output it.  */
            crmode();
            getch();
            nocrmode(); /* Turn off cbreak. */
            mvwaddstr(win1, 5, 5, str);
            mvwaddstr(win1, 7, 7, "Type something to clear the screen");
            wrefresh(win1);

            /*  Get another character, then delete the window.  */
            getch();
            wclear(win1);
            touchwin(stdscr);
            endwin();
        }

      In this example, the first call to getch returns as soon as one
      character is entered, because crmode was called before getch
      was called. The second time getch is called, it waits until the
      Return key is pressed before processing the character entered,
      because nocrmode was called before getch was called the second
      time.
Close Help