Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> eoln test for end of line pp 102</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 EOLN                        Test For End of Line                     pp 102

 Syntax:  Eoln (TextFileVar) ;

 Type:    Boolean

 Form:    Function

 Purpose: A Boolean function which returns True if the text file pointer is
          at the end of file or the end of the current file line.

 Notes:   Eoln can be used with Read to determine the current position in the
          file line of text.  Read can become stuck at the end of the current
          line, as it does not advance the file pointer to the next line.
          ReadLn is used to advance the pointer to the next line.


 ----------------------------------------------------------------------------


 Usage:
      VAR
          TextFileVar  : Text                  ;  { Define a text file   }
          TextVar      : String [8]            ;  { Input variable       }

       BEGIN
           Assign (TextFileVar,'C:Name.Ext')   ;  { Assign file name     }
           Reset  (TextFileVar)                ;  { Open for processing  }
           While Not Eof (TextFileVar) Do         { Do until end of file }
             Begin
             While Not Eoln (TextFileVar) Do      { Read current line    }
               Begin
               Read (TextFileVar, TextVar)     ;  { Read file line       }
               End                             ;
             ReadLn                            ;  { Advance to next line }
             End                               ;
           Close (TextFileVar)                 ;  { Close the file       }
       END.

See Also: Eof Read ReadLn SeekEof SeekEoln

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson