home *** CD-ROM | disk | FTP | other *** search
/ PC Media 2 / PC MEDIA CD02.iso / share / prog / tpsorts / lcase.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-03-12  |  1.8 KB  |  71 lines

  1. {$c-}
  2. program lcase(input,output);
  3.  
  4.  
  5. {
  6.                            version 1.1
  7.  
  8. This  is  an  example of how to redirect input and  output  using 
  9. Turbo  Pascal.Those of you who may have purchased  'Turbo  Tutor' 
  10. and  found that the program titled 'FILTER.PAS' does'nt,  will be 
  11. happy to know that this program DOES!!
  12.  
  13. In  this example,  the program will redirect or filter any  file, 
  14. converting all text to lower case.
  15.  
  16. This new version is much faster; it processes up to 32k with only 
  17. one  disk  access.   Also,  the input-output routines  have  been 
  18. placed in their own 'included' file.
  19.  
  20.  
  21. If there are problems with this program call me:
  22.     Ken Kaplan
  23.     213-596-8635 (ans. machine)
  24.  
  25. Try typing 'DIR |LCASE'...and have fun!
  26.  
  27. copyright (c) 1985 Renaissance Software
  28. }
  29.  
  30. const
  31.      buffsize=$7fff;
  32.  
  33. type
  34.     aptr     =^data;
  35.     data     =record
  36.                     dta:array[1..buffsize] of byte;
  37.               end;
  38.  
  39.  
  40. var
  41.  
  42.    error,i,
  43.    bytes     :integer;
  44.    done      :boolean;
  45.    dtaptr    :aptr;
  46.  
  47. {$i stand_io.inc}
  48.  
  49. begin
  50.      repeat
  51.            done:=false;
  52.            i:=1;
  53.            new(dtaptr);
  54.            bytes:=buffsize;
  55.            with dtaptr^ do begin
  56.                 stdread(bytes,error,seg(dta),ofs(dta));
  57.                 if error<>$01 then begin
  58.                 repeat
  59.                       if ((dta[i]>64) and (dta[i]<91)) then
  60.                          dta[i]:=dta[i]+32;
  61.                       i:=i+1;
  62.                 until ((dta[i]=26) or (i=buffsize+1));
  63.                 stdwrite(bytes,error,seg(dta),ofs(dta));
  64.                 end
  65.                 else
  66.                     done:=true;
  67.            end;
  68.      until done;
  69.      dispose(dtaptr);
  70. end.
  71.