CP-866
- program doc;
- uses crt;
- const encoding='CP-866';
- maxitem=3;
- type bit=1..maxitem+8;
- var fltxt:text;
- path,flstrng:string;
- ior:integer;
- choise:bit;
- procedure drawcrt;
- begin textcolor(6);
- textbackground(1);
- clrscr end;
- procedure drawencoding;
- begin writeln(encoding);
- writeln end;
- procedure logic(choise:bit);
- forward;
- procedure opening;
- forward;
- procedure creation;
- forward;
- procedure load;
- forward;
- procedure menu;
- begin repeat writeln('1. Open');
- writeln('2. Create');
- writeln('3. Clear');
- writeln;
- write('Choise: ');
- readln(choise);
- if choise>maxitem then begin writeln;
- writeln('Error. 1 or ',maxitem);
- writeln('Press "enter" to start anew.');
- readln end else break until false;
- writeln;
- logic(choise) end;
- procedure logic(choise:bit);
- begin if choise=1 then opening;
- if choise=2 then creation;
- if choise=3 then begin clrscr;
- load end end;
- procedure opening;
- begin repeat write('Path: ');
- readln(path);
- assign(fltxt,path);
- {$i-} reset(fltxt); {$-+}
- ior:=ioresult;
- if ior<>0 then begin writeln;
- writeln('Error. The wrong way.');
- writeln('Press "enter" to start anew.');
- readln end else begin writeln;
- while not eof(fltxt) do begin readln(fltxt,flstrng);
- writeln(flstrng) end;
- break end until false;
- close(fltxt);
- writeln;
- writeln('Completed.');
- writeln('Press "enter" to choise menu.');
- readln;
- load end;
- procedure creation;
- begin write('Path: ');
- readln(path);
- writeln;
- assign(fltxt,path);
- rewrite(fltxt);
- write('Text: ');
- readln(flstrng);
- write(fltxt,flstrng);
- close(fltxt);
- writeln;
- writeln('Completed.');
- writeln('Press "enter" to choise menu.');
- readln;
- load end;
- procedure load;
- begin drawencoding;
- menu end;
- begin drawcrt;
- load end.
Открывает и сохраняет текстовые файлы с изменённой кодировкой.