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

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