home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / vpascal.zip / FILEDEMO < prev    next >
Text File  |  1985-08-08  |  896b  |  27 lines

  1. PROGRAM FILEDEMO; {a demonstration of reading from the terminal,}
  2. {writing to a disk file, then reading the disk file to the screen.}
  3. VAR
  4.    DISKFILE:TEXT;
  5.    S1:STRING;
  6.    
  7.    
  8. BEGIN
  9.    WRITELN('filedemo demonstration program');
  10.    ASSIGN(DISKFILE,'file1');    {DISKFILE will have name 'file1'}
  11.    REWRITE(DISKFILE);           {set it up for writing}
  12.    REPEAT
  13.       WRITE('line:');           {prompt for user input}
  14.       READLN(S1);               {press F6 CR to enter an EOF}
  15.       WRITELN(DISKFILE,S1);     {write to disk file}
  16.    UNTIL EOF(INPUT);
  17.    WRITELN;
  18.    RESET(DISKFILE);             {now set up to read the disk file}
  19.    WHILE NOT EOF(DISKFILE) DO
  20.       BEGIN
  21.          READLN(DISKFILE,S1);
  22.          WRITELN(S1);           {and copy it to the screen}
  23.       END;
  24.    WRITELN("that's all!");
  25. END.
  26.  
  27.