home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / visionix / demos / viewansi.pas next >
Encoding:
Pascal/Delphi Source File  |  1993-12-29  |  1.7 KB  |  101 lines

  1. {$M 40000,16000,16000}
  2.  
  3. Program ViewAnsi;
  4.  
  5. uses
  6.  
  7.   vtypesu,
  8.   vcrtu,
  9.   dos,
  10.   vdoshu,
  11.   VAnsiiou,
  12.   VAvtiou,
  13.   voutu;
  14.  
  15. Var
  16.  
  17.   F       : FILE;
  18.   CH      : CHAR;
  19.  
  20.   Buff    : String;
  21.  
  22.   numread : word;
  23.  
  24.   finfo   : searchrec;
  25.  
  26.  
  27. BEGIN
  28.  
  29.   { attach the ansi and avatar filters to the CRT channel }
  30.  
  31.   VOutFilterAttach( CrtOCH,
  32.                     0,
  33.                     'ANSIFILTER',
  34.                     'Bx00VMEM',
  35.                     AnsiFilter,
  36.                     0,0,0            );
  37.  
  38.   VOutFilterAttach( CrtOCH,
  39.                     0,
  40.                     'AVTFILTER',
  41.                     'Bx00VMEM',
  42.                     AvatarFilter,
  43.                     0,0,0             );
  44.  
  45.  
  46.   If ParamCount>0 Then
  47.   BEGIN
  48.  
  49.     { get the first file }
  50.  
  51.     FindFirst( ParamStr(1), archive, Finfo );
  52.  
  53.     While DosError=0 Do
  54.     BEGIN
  55.  
  56.       ClrScr;
  57.  
  58.       { open the file }
  59.  
  60.       Assign( F, GetDirFromPath( ParamStr(1) )+FInfo.Name );
  61.       Reset( F,1 );
  62.  
  63.       While Not Eof( F ) Do
  64.       BEGIN
  65.  
  66.         { read in a block }
  67.  
  68.         BlockRead( F, buff[1], 128, numread );
  69.  
  70.         buff[0]:=chr(numread);
  71.  
  72.         { write it to the screen }
  73.  
  74.         Write( Buff );
  75.  
  76.       END;
  77.  
  78.       { close this file and try the next }
  79.  
  80.       Close( F );
  81.  
  82.       FindNext( Finfo );
  83.  
  84.     END; { while doserror=0 }
  85.  
  86.   END
  87.   ELSE
  88.   BEGIN
  89.  
  90.     WriteLn;
  91.     WriteLn('ViewAnsi - Ansi & Avatar File display program');
  92.     WriteLn('A Demo from the VisionTools for Pascal library package.');
  93.     WriteLn('Verson 0.9; December 28, 1993');
  94.     WriteLn;
  95.     WriteLn('Usage: ViewAnsi filename     (filename can include wildcards)');
  96.     WriteLn;
  97.  
  98.   END;
  99.  
  100. END.
  101.