NBPrg40. EDFILE.PAS. MiniOS. OpenSource.

NBPrg40. EDFILE.PAS. MiniOS. OpenSource.
***************************************

{ Nikita Beloshenko (GNU) 2013 }

Unit EDFILE;

(*
   EDFILE.PAS

   +---------------------------+ 
   |                           | 
   |      E D F I L E          | 
   |                           | 
   +---------------------------+ *)

Interface

Procedure EditFILE_run;

Implementation

{ Edit File }
Procedure EditFILE_run;
Label
  START;
Var
  Name,S : String;
  S1     : String;
  T,T1   : Text;
  N,i    : Integer;
  Ch     : Char;
Begin

START :
  WriteLn(' +---------------------------+ ');
  WriteLn(' |                           | ');
  WriteLn(' |      E D F I L E          | ');
  WriteLn(' |                           | ');
  WriteLn(' +---------------------------+ ');
  WriteLn('                               ');
  WriteLn(' Nikita Beloshenko (GNU) 2013 ');
  WriteLn(' ----- File->(Edit) 2013 {(text) (module)} ----- ');

  WriteLn(' ');

  WriteLn(' Name? ');

  ReadLn(Name);

  Assign(T,Name);
  Reset(T);

  Assign(T1,'EDBuf.tmp');
  ReWrite(T1);

  While Not eof(T) Do
  Begin
    ReadLn(T,S);
    WriteLn(S);
    S1 := '';
    While ((S1<>'y') And (S1<>'n')) Do
    Begin
      WriteLn('----- ?(new string)?>y/n -----');
      ReadLn(S1);
    End;
    If S1='y' Then
    Begin
      WriteLn('----- ?(new string)?> -----');
      ReadLn(S);
    End;
    WriteLn(T1,S);
  End;

  Close(T1);

  Close(T);

  { REWRITE }

  Assign(T,Name);
  ReWrite(T);

  Assign(T1,'EDBuf.tmp');
  Reset(T1);

  While Not eof(T1) Do
  Begin
    ReadLn(T1,S);
    WriteLn(T,S);
  End;

  Close(T1);

  Close(T);

  { GOTO START ? }

  S := '';

  While ((S<>'y') And (S<>'n')) Do
  Begin
    WriteLn(' ----- GOTO START? (Another File) ----- ');
    WriteLn('y/n');
    ReadLn(S);
  End;

  If S='y' Then Goto START;

End;

End.