home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / 2MONITOR.ZIP / CSAVE.C next >
C/C++ Source or Header  |  1989-09-10  |  1KB  |  42 lines

  1. /* CSAVE - - 'Prints' Color Screen to a file                              */
  2. #define INCL_BASE
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <os2.h>
  6. #include <ctype.h>
  7.  
  8. VIOPHYSBUF     viopbBuf;                  /* Structure for physical buf   */
  9. PCH            pchScreen;
  10.  
  11. void main(int argc, char **argv)
  12.  
  13. {
  14.    register int   i;
  15.    int      row, col;
  16.    FILE     *filehandle;
  17.  
  18.    if(argc < 2)
  19.       {
  20.       printf("Usage is:  CSAVE filename\n");
  21.       return;
  22.       }
  23.    filehandle = fopen(argv[1],"w");       /* Open output file             */
  24.    viopbBuf.pBuf = (PCH) 0xB8000L;
  25.    viopbBuf.cb = 4000;
  26.    VioGetPhysBuf(&viopbBuf, 0);
  27.    pchScreen = MAKEP(viopbBuf.asel[0],0);
  28.    i = 0;
  29.    for(row = 1; row <= 25; ++row)
  30.       {
  31.       for (col = 1; col <= 80; ++col)
  32.          {
  33.          fputc(*(pchScreen + i), filehandle); /* Put chars to file            */
  34.          i += 2;
  35.          }
  36.       fputc('\n', filehandle);            /* Newline after 80 cols        */
  37.       }
  38.    return;                                                 
  39. }
  40.  
  41.  
  42.