Skip to content

Instantly share code, notes, and snippets.

@rkumar
Created September 20, 2010 08:47
Show Gist options
  • Select an option

  • Save rkumar/587622 to your computer and use it in GitHub Desktop.

Select an option

Save rkumar/587622 to your computer and use it in GitHub Desktop.
#include <ncurses.h>
// it seems system echo is the only way to print some stuff in cooked mode
// i am trying to figure out how VIM displays the result of :ls
int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!! Hit a key\n"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch();
def_prog_mode(); /* Save the tty modes */
endwin(); /* End curses mode temporarily */
int i = 0;
for (i = 0; i < 5; i++) {
system("echo inside cooked mode");
}
//printf("helllow there\n");
//system("/bin/ls"); /* Do whatever you like in cooked mode */
//system("read");
//system("/bin/sh"); /* Do whatever you like in cooked mode */
//system("echo hit a key"); /* Do whatever you like in cooked mode */
//printw("Hit a key buddy\n"); /* Print Hello World */
reset_prog_mode(); /* Return to the previous tty mode*/
getch();
/* stored by def_prog_mode() */
refresh(); /* Do refresh() to restore the */
/* Screen contents */
printw("After cooked mode.\nKey to quit"); /* Back to curses use the full */
getch();
refresh(); /* capabilities of curses */
endwin(); /* End curses mode */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment