U
Uno
I've been working through the material in faq 19.1:
http://www.c-faq.com/osdep/cbreak.html
.. Only one main program is shown there, and this one is definitely not
behaving well:
$ pwd
/home/dan/source
$ gcc -Wall -Wextra -lcurses p3.c -o out
$ ./out
$ cat p3.c
#include <stdio.h>
#include <curses.h>
int tty_break()
{
initscr();
cbreak();
return 0;
}
int tty_getchar()
{
return getch();
}
int tty_fix()
{
endwin();
return 0;
}
int main(void)
{
int i;
if(tty_break() != 0)
return 1;
for(i = 0; i < 10; i++)
printf(" = %d\n", tty_getchar());
tty_fix();
return 0;
}
// gcc -Wall -Wextra -lcurses p3.c -o out
$
So far I have output that looks like this and then disappears:
http://i50.tinypic.com/28bxm43.png
I have a variety of questions about this library written in C. I don't
get what tty_fix is supposed to be doing, partially because I don't know
what endwin is doing.
How and where do I grep for endwin()?
Thanks for your comment, and cheers,
http://www.c-faq.com/osdep/cbreak.html
.. Only one main program is shown there, and this one is definitely not
behaving well:
$ pwd
/home/dan/source
$ gcc -Wall -Wextra -lcurses p3.c -o out
$ ./out
$ cat p3.c
#include <stdio.h>
#include <curses.h>
int tty_break()
{
initscr();
cbreak();
return 0;
}
int tty_getchar()
{
return getch();
}
int tty_fix()
{
endwin();
return 0;
}
int main(void)
{
int i;
if(tty_break() != 0)
return 1;
for(i = 0; i < 10; i++)
printf(" = %d\n", tty_getchar());
tty_fix();
return 0;
}
// gcc -Wall -Wextra -lcurses p3.c -o out
$
So far I have output that looks like this and then disappears:
http://i50.tinypic.com/28bxm43.png
I have a variety of questions about this library written in C. I don't
get what tty_fix is supposed to be doing, partially because I don't know
what endwin is doing.
How and where do I grep for endwin()?
Thanks for your comment, and cheers,