home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / bs_hwscr.zip / TXT2SCR.PAS < prev   
Pascal/Delphi Source File  |  1993-04-18  |  1KB  |  33 lines

  1. {Converts example.txt into example.hdw ascii# 33-100 are allowed.Due to the gfx.
  2.  all you have to do is count the numbers of bytes and write it at
  3.  the top of the file nl.' maxtxt=....' and ofcourse recompile the hscroll.pas.
  4.  I know you can code that but he I'm to lazy to do it all... .}
  5. uses crt;
  6. var f:file of char;
  7.     p:text;
  8.     x:integer;
  9.     ch:char;
  10. begin
  11.      assign(f,'example.txt');
  12.      reset(f);
  13.      assign(p,'example.hdw');
  14.      rewrite(p);
  15.      x:=1;
  16.      writeln(p,'const maxtxt = .....;');
  17.      writeln(p,' txt:array[0..maxtxt] of byte = (');
  18.      write(p,255,',');
  19.      while not eof(f) do
  20.      begin
  21.           read(f,ch);
  22.           inc(x);
  23.           if (ord(upcase(ch))-33 < 0) or (ord(upcase(ch))-33 >57)
  24.              then write(p,255,',')                           {255 --> blank}
  25.           else write(p,ord(upcase(ch))-33,',');
  26.           if x mod 20 = 0 then writeln(p);                   {use proper files!!}
  27.      end;
  28.      write(p,');');
  29.      write(#7,#7);
  30.      close(f);
  31.      close(p);
  32. end.
  33.