program FileDemo;
const
  FileName = 'TEST.TXT';
var
  FileVar : Text;
  InString : String;
begin
  Assign(FileVar,FileName);
  Rewrite(FileVar);
  WriteLn(FileVar,'Write this to a file');
  Close(FileVar);
  Assign(FileVar,FileName);
  Reset(FileVar);
  Readln(FileVar,InString);
  Close(FileVar);
  WriteLn(InString);
end.
