Category : C Source Code
Archive   : CURSES04.ZIP
Filename : HELLO.C

 
Output of file : HELLO.C contained in archive : CURSES04.ZIP
/* hello.c - a simple curses program */

#include

main()
{
WINDOW *win;

/* initialize screen, and check for failure */
if( ERR == initscr() ) {
printf("initscr failed!\n");
exit(1);
}
/* set up 'win' to be the standard screen.
* (Despite the macros for handling stdscr, it is
* easier in the long term not to use them.)
*/
win = stdscr;

/* set up tty modes */
raw(); /* ignore ^C, etc. */
noecho(); /* do not echo input */
keypad(win, TRUE); /* should generally use this on the PC */
leaveok(win, TRUE); /* turn off cursor for this window */

/* position cursor and write message to window */
wmove(win, LINES/2, 22);
waddstr(win, "Hello world!");

/* turn on inverse video mode */
wattrset(win, A_REVERSE);

/* can write and move at the same time */
mvwaddstr(win, LINES/2+2, 18, "Hit any key to continue");

/* turn off inverse video mode */
wattrset(win, 0);

/* display the window */
wrefresh(win);

/* wait for the user to press a key, discarding the input */
(void)wgetch(win);

/* standard termination */
endwin();

exit(0);
}



  3 Responses to “Category : C Source Code
Archive   : CURSES04.ZIP
Filename : HELLO.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/