home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WHEELS.ZIP / SAFEWRIT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-12-02  |  1.1 KB  |  34 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5. driver for procedure SAFEWRITE--writes any file to screen even if it contains
  6. control characters.  Input a filename (try with .COM and .EXE files), output
  7. to screen a "safe" version of that file.
  8. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
  9. type
  10.   filename_type = string[14];
  11. {$I existfil.lib}
  12. {$I safewrit.lib}
  13.  
  14. var
  15.   File_to_show : filename_type;
  16.   File_itself  : file of byte;
  17.   one_byte     : byte;
  18. begin
  19.   Write('Enter name of file: ');
  20.   Read(file_to_show);
  21.   ClrScr;
  22.   if exists(file_to_show) then
  23.     begin
  24.       Assign(file_itself,file_to_show);
  25.       reset(file_itself);
  26.       while not EOF(file_itself) do
  27.         begin
  28.           read(file_itself,one_byte);
  29.           safeWrite(one_byte);
  30.         end;
  31.       close(file_itself);
  32.     end
  33.   else WriteLn(file_to_show,' does not exist.');
  34. end.