[comp.lang.pascal] Saving screen to disk

C0361@univscvm.csd.scarolina.edu ( Thomas Jenkins) (11/15/90)

The previous example will get the screen AND has all the info neede to write
to the disk.  Try:

PROCEDURE WriteScreen ( VAR buf                  ;
                            bytesToWrite         : WORD ;
                            fileName             : STRING ) ;
 VAR
         f                                       : FILE ;
         numWritten                              : WORD ;

  BEGIN
    Assign ( f , fileName ) ;
    ReWrite ( f , 1 ) ;        {    ,1 VERY important :-)  }
    BlockWrite ( f , buf , bytesToWrite , numWritten ) ;
    IF ( numWritten < bytesToWrite )
     THEN
      BEGIN
        {  Error handling here - probably full disk  }
      END ;  {  IF  }
  END ;  {  WriteScreen  }


ReadScreen would be just the oppisite :-).

  I haven't tried this code ( on the fly as it were ) but it works fine in
my encryption, indexfiles, and sorting units.

tom

THOMAS E. JENKINS, JR.

  PROGRAMMER, UNIVERSITY OF SOUTH CAROLINA
    BITNET, C0361 AT UNIVSCVM.BITNET
     INTERNET C0361 AT UNIVSCVM.CSD.SCAROLINA.EDU