{@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
The purchaser of these procedures and functions may include them in COMPILED
programs freely, but may not sell or give away the source text.

driver for procedure SAFEWRITE--writes any file to screen even if it contains
control characters.  Input a filename (try with .COM and .EXE files), output
to screen a "safe" version of that file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
type
  filename_type = string[14];
{$I existfil.lib}
{$I safewrit.lib}

var
  File_to_show : filename_type;
  File_itself  : file of byte;
  one_byte     : byte;
begin
  Write('Enter name of file: ');
  Read(file_to_show);
  ClrScr;
  if exists(file_to_show) then
    begin
      Assign(file_itself,file_to_show);
      reset(file_itself);
      while not EOF(file_itself) do
        begin
          read(file_itself,one_byte);
          safeWrite(one_byte);
        end;
      close(file_itself);
    end
  else WriteLn(file_to_show,' does not exist.');
end.