home *** CD-ROM | disk | FTP | other *** search
- #define DEVNULL 0
- #define EGA 1
- #define POSTSCRIPT 2
- #define HERCULES 3
- #define NO9 4
- #define CGA 5
- #define HP 6
- #define EP 7
- #define ELO 8
-
- #define BUFSIZE 6000
-
- #include <stdio.h>
- #include <dos.h>
-
- char testbuf[BUFSIZE]; /* text input buffer */
- FILE *plot;
-
- writeln(c)
- char *c;
- {
- fprintf(plot,"%s",c);
- }
-
- charout(c)
- char c;
- { fputc(c,plot); }
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int w1;
-
- VGinit();
- plot=fopen("tekout.x","wb");
- /* RGPoutfunc(writeln);
- RGHPoutfunc(writeln);
- RGEPoutfunc(charout);*/
-
- if (argc < 3) w1=VGnewwin(HERCULES,0);
- else w1=VGnewwin((argv[2][0] - 48),0); /* 2nd param is device number */
-
- VGuncover(w1);
- VGpage(w1);
- if (argc==1) showfile(w1,"file1.tek");
- else showfile(w1,argv[1]); /* 1st param is filepath */
-
- /*
- VGpage(w1);
- drawall(w1);
- VGpage(w1);
- VGredraw(w1,w1);
- */
-
- VGtmode(w1);
- VGclose(w1);
-
- } /* end main() */
-
-
- static drawall(vw)
- /* redraw the whole thing incrementally */
- {
- int i;
- while (!(i=VGpred(vw,vw)));
- }
-
-
- static showfile(vw,fname)
- int vw;
- char *fname;
- /*
- Read the file named by fname and display it in the window.
- */
- {
- int datalen,i;
- FILE *fp = fopen(fname,"ra");
- if (fp != NULL) {
- while ((datalen = fread(testbuf,1,BUFSIZE,fp)) > 0) {
- for (i=0; i<datalen ; i++)
- VGwrite(vw,&testbuf[i], 1);
- }
- fclose(fp);
- }
- }
-