www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/08/26/05:13:52

To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: A DOT APPLEYARD AT fs1 DOT mt DOT umist DOT ac DOT uk
Date: 26 Aug 93 09:52:53 GMT
Subject: Copying screen to file

  "Mr. Richard Seabrook" <seabrook AT umbc DOT edu> wrote on Wed 25 Aug 1993 17:22:09
-0500 (EDT) (Subject: no subject (file transmission)):-
  > Here are the error messages I got (painfully retyped by me since I
couldn't redirect !@*%#***@@#! stderr under DOS) ...

Here is a Gnu C++ program that I wrote to copy the text screen onto a file:-

/* copies text screen onto file T$SCREEN . compile with -lpc */
#include<stdio.h>
#include<pc.h>
main(){int cols=ScreenCols(),rows=ScreenRows(); char s[cols+1];
unsigned short*screen=(unsigned short*)ScreenPrimary; int i,j,k;
FILE*F=fopen("t$screen","w");
for(i=0;i<rows;i++) {for(j=0;j<cols;j++) s[j]=255&screen[i*cols+j];
    for(j=cols-1;j>=0;j--) if(s[j]!=' ') break;
    s[k=j+1]=0; for(j=0;j<k;j++) putc(s[j],F); putc('\n',F);}
fclose(F);}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019