QP School
File I/O in Object Pascal - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: Object Pascal Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=50)
+--- Thread: File I/O in Object Pascal (/showthread.php?tid=5050)



File I/O in Object Pascal - Qomplainerz - 07-25-2023

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.