home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_01 / 8n01091b < prev    next >
Text File  |  1990-02-19  |  1KB  |  50 lines

  1. Listing 2
  2. ------------------------------------------------------------
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. #define XSIZE  50
  7. #define YSIZE  15
  8.  
  9. char newbuffer[XSIZE * YSIZE * 2]; /* Allow for Attributes */
  10. char oldbuffer[XSIZE * YSIZE * 2];
  11.  
  12. main()
  13. {
  14. int i, j;
  15. char key_string[15];
  16.  
  17. /* Get the existing screen area and store it in oldbuffer.
  18.  * Subtract 1 from size, since the 1st position is 0.
  19.  */
  20. gettext(5,5,5+XSIZE-1,5+YSIZE-1,oldbuffer);
  21.  
  22. /* Clear the new window area (newbuffer) */
  23. for (i = 0; i < YSIZE; i++) {
  24.    for (j = 0; j < XSIZE*2; j+=2) {
  25.       newbuffer[i*XSIZE*2+j] = ' ';       /* Blank Space */
  26.       newbuffer[i*XSIZE*2+j+1] = '\35';   /* Attribute */
  27.       }
  28.    }
  29.  
  30. /* Loop through 10 times */
  31. for (j = 0; j < 10; j++) {
  32.  
  33.   /* Print YSIZE lines */
  34.    for (i = 0; i < YSIZE; i++) {
  35.       sprintf(key_string,"Value %.3d",i+(j*(int)YSIZE));
  36.       puttext_write(1,i,XSIZE,YSIZE,key_string,\
  37.                                        '\35',newbuffer);
  38.       }
  39.  
  40.    /* Show it on the screen */
  41.    puttext(5,5,5+XSIZE-1,5+YSIZE-1,newbuffer);
  42.    delay(500);
  43.    }
  44.  
  45. /* Restore the original screen */
  46. puttext(5,5,5+XSIZE-1,5+YSIZE-1,oldbuffer);
  47. }
  48. ------------------------------------------------------------
  49.  
  50.