home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19480 < prev    next >
Encoding:
Text File  |  1993-01-09  |  1.5 KB  |  47 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!gatech!concert!uvaarpa!murdoch!sphinx.phys.Virginia.EDU!bryan
  3. From: bryan@sphinx.phys.Virginia.EDU (bryan wright)
  4. Subject: Curses question: printf after initscr
  5. Message-ID: <1993Jan9.223815.22617@murdoch.acc.Virginia.EDU>
  6. Sender: usenet@murdoch.acc.Virginia.EDU
  7. Organization: University of Virginia
  8. Date: Sat, 9 Jan 1993 22:38:15 GMT
  9. Lines: 36
  10.  
  11. Hi folks,
  12.     This may be a FAQ, but it doesn't seem to be frequently answered:
  13.  
  14. Why does the following program wait for a carriage return before sending
  15. the text "hello there" to the screen?  (OS is Ultrix 4.0 on a DS3100.)
  16.  
  17. #include <stdio.h>
  18. #include <cursesX.h>
  19. main()
  20. {
  21.     char string[BUFSIZ];
  22.  
  23.     initscr();
  24.     endwin();
  25.     printf ("hello there");
  26.     gets ( string );
  27.  
  28. }
  29.  
  30. This comes up because I'd like to write a curses interface for an existing
  31. application.  Ideally, I'd call initscr at startup, then switch between
  32. curses and plain text by using 'refresh' and 'endwin'.  Unfortunately, once
  33. I've called initscr I have to explicitly flush stdout whenever I use printf
  34. thereafter.  I'd hate to have to rewrite all the I/O in terms of curses 
  35. routines.
  36.  
  37.     Is there something simple I'm missing?  Any advice would be 
  38. appreciated.
  39.  
  40.                 Thanks in advance,
  41.                 Bryan
  42. --
  43. ===============================================================================
  44. Bryan Wright                |"If you take cranberries and stew them like 
  45. Physics Department          | applesauce, they taste much more like prunes 
  46. University of Virginia      | than rhubarb does."  --  Groucho 
  47.