All pastes #78916 Raw Edit

Paw-Fox

public text v1 · immutable
·published 2006-07-04 18:12 UTC
rendered paste body
{*
   Name: Read quotes from file
   Author: David - Paw-Fox 2006
   Description: Opens a file and reads the quote on screen
   Date: 4th July 06
   Copyright: Paw-Fox 2006
*}

uses crt;
var

F : text;
s : string;


Begin
randomize;
clrscr;
       write('Please enter file name: ');
       readln(s); {store the file name in var "s"}
       assign(F,s); { Assocates the filename with the text variable}
       reset(F); {Open the file that was stored in "F"}
while not EOF(F) do  { So when it reaches the end of the txt file it stop - EOF = End Of File -}
      begin {start the sub begin}
            readln(F,s); {real the file name}
            write(s); {writes the text from the txt file into the screen}
             readln;
end; {end sub heading}
      close(F); {closes the file}
end.