hello2.c 539 B

123456789101112131415161718192021222324252627
  1. /* hello2.c
  2. * purpose show how to use curses functions with a loop
  3. * outline initialize, draw stuff, wrap up
  4. */
  5. #include <stdio.h>
  6. #include <curses.h>
  7. main()
  8. {
  9. int i;
  10. initscr(); /* turn on curses */
  11. clear(); /* draw some stuff */
  12. for(i=0; i<LINES; i++ ){ /* in a loop */
  13. move( i, i+i );
  14. if ( i%2 == 1 )
  15. standout();
  16. addstr("Hello, world");
  17. if ( i%2 == 1 )
  18. standend();
  19. }
  20. refresh(); /* update the screen */
  21. getch(); /* wait for user input */
  22. endwin(); /* reset the tty etc */
  23. }