Mail Archives: djgpp/1992/10/29/09:22:16
> How can I get the Gnu C/C++ compiler to send the compiler error remarks to a
file as well as to the screen?...
I wrote this short Gnu C program, which copies the current text screen onto
a file called T$SCREEN in the current directory. It has proved useful:-
/* 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 -