var
myFile : TextFile;
text : string;
begin
AssignFile(myFile, 'Test.txt'); // Попытка открыть файл Test.txt для записи
ReWrite(myFile);
WriteLn(myFile, 'Hello'); // Запись нескольких известных слов в этот файл
WriteLn(myFile, 'World');
CloseFile(myFile); // Закрытие файла
Reset(myFile); // Переооткрытие файла в режиме только для чтения
while not Eof(myFile) do // Показ содержимого файла
begin
ReadLn(myFile, text);
ShowMessage(text);
end;
CloseFile(myFile); // Закрытие файла в последний раз
end;