QP School

Full Version: File I/O in Object Pascal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
program FileIOExample;
var
  inputFile: TextFile;
  num: Integer;
begin
  AssignFile(inputFile, 'input.txt');
  Reset(inputFile);

  while not Eof(inputFile) do
  begin
    ReadLn(inputFile, num);
    WriteLn('Read number: ', num);
  end;

  CloseFile(inputFile);
end.