{ --------------------------------------------------------------------------- Xenion utility -- 2text v.1beta Formatta file di testo e non : inserisce nel file output i bytes compresi tra 32, 126 e altri 7 speciali ( sistema le a', i', u', o', e', tab e ogni x caratteri inserisce un , lasciando cmq quelli gia'' presenti Per qualsiasi motivo puoi contattarmi a xenion@libero.it --------------------------------------------------------------------------- } uses crt; var file2: Text; file1 : file of byte; c,d,conta,byt0 : byte; outfile,infile,numchar : string; stat : array[1..10] of longint; line : integer; size,cont0 : longint; function strtoint(str: string) : longint; var a : integer; b : longint; begin val(str,b,a); strtoint:=b; end; label fine; begin clrscr; writeln; writeln(' -- Xenion utility -- 2text v.1beta'); writeln; infile:=ParamStr(1); outfile:=ParamStr(2); numchar:=ParamStr(3); if (infile='') then begin writeln; writeln(' *** Utility per formattare file di testo e non ***'); writeln; writeln(' > inserisce nel file output i bytes compresi tra 32, 126 e altri 7 speciali'); writeln(' ( sistema le a'', i'', u'', o'', e'', tab e )'); writeln(' > ogni x caratteri inserisce un , lasciando cmq quelli gia'' presenti'); writeln; writeln; writeln(' $txt2txt [inputfile] [outputfile] [x]'); writeln; writeln(' [inputfile] : file da formattare'); writeln(' [outputfile] : file output'); writeln(' [x] : numero di caratteri per riga'); writeln; writeln(' Per qualsiasi motivo, puoi contattarmi a xenion@libero.it'); goto fine; end; {$I-} Assign(file1,infile ); Reset(file1); Close(file1); {$I+} if not ((IOResult = 0) and (infile <> '')) then begin writeln(' File input non trovato'); goto fine; end; line:= strtoint(numchar); if line=0 then line:=80; Assign(file1, infile); Reset(file1); Assign(file2, outfile); Rewrite(file2); size:=filesize(file1); writeln(' Dimensione file input : ',size,' bytes'); writeln(' File input : ',infile); writeln(' File output : ',outfile); writeln(' Caratteri per riga : ',line); writeln(' N^ righe : ',size/line:10:2); writeln; write(' Wait please ... '); cont0:=0; conta:=0; c:=13; d:=10; for conta:=1 to 10 do stat[conta]:=0; conta:=0; repeat conta:=conta+1; cont0:=cont0+1; if conta= (line+1) then conta:=1; read(file1,byt0); if conta = line then Write(file2,chr(13),chr(10)); case byt0 of 10 : begin Write(file2,chr(13),chr(10)); conta:=conta+1; stat[1]:=stat[1]+1; end; 224 : begin Write(file2,'a'''); conta:=conta+1; stat[2]:=stat[2]+1; end; 236 : begin Write(file2,'i'''); conta:=conta+1; stat[3]:=stat[3]+1; end; 249 : begin Write(file2,'u'''); conta:=conta+1; stat[4]:=stat[4]+1; end; 242 : begin Write(file2,'o'''); conta:=conta+1; stat[5]:=stat[5]+1; end; 233,232 : begin Write(file2,'e'''); conta:=conta+1; stat[6]:=stat[6]+1; end; 9 : begin Write(file2,' '); conta:=conta+1; stat[7]:=stat[7]+1; end; end; if (byt0 > 31) and (byt0 < 127) then Write(file2,chr(byt0)); until cont0 = size; writeln('k'); writeln; writeln(' - Statistiche -'); writeln; writeln(' Ritorno carrello : ',stat[1]); writeln(' a'' : ',stat[2]); writeln(' i'' : ',stat[3]); writeln(' u'' : ',stat[4]); writeln(' o'' : ',stat[5]); writeln(' e'' : ',stat[6]); writeln(' tab : ',stat[7]); Close(file1); Close(file2); writeln; fine: end.