var
  myFile : TextFile;
  letter : char;
  text : string;

begin
  // Try to open the Test.txt file for writing to
  Assign(myFile, 'Test.txt');
  ReWrite(myFile);

  // Write lines of text to the file
  WriteLn(myFile, 'Hello');
  WriteLn(myFile, 'To you');

  // Close the file
  Close(myFile);

  Reset(myFile);
  while not Eof(myFile) do
  begin
    readln(myFile, text);
    writeln(text);
  end;
  Close(myFile);

  // Reopen the file for reading
  Reset(myFile);

  // Display the file contents
  while not Eof(myFile) do
  begin
    // Proces one line at a time
    writeln('Start of a new line :');
    while not Eoln(myFile) do
    begin
      Read(myFile, letter); // Read and display one letter at a time
      write(letter);
    end;
    ReadLn(myFile, text);
    writeln(text);
  end;

  // Close the file for the last time
  Close(myFile);
end.

{http://www.delphibasics.co.uk/RTL.asp?Name=Eoln}