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> seekeoln test for end of line pp 102</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SEEKEOLN                    Test For End of Line                     pp 102

 Syntax:  SeekEoln (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:   Similar to SeekEoln except that blanks and tabs are skipped
          priot to testing for the end of line marker (CR/LF).

          SeekEoln 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 SeekEoln (TextFileVar) Do  { Read current line   }
               Begin
               Read (TextFileVar, TextVar)     ;  { Read variable from file }
               End                             ;
             ReadLn                            ;  { Advance to next line    }
             End                               ;
           Close (TextFileVar) ;               ;  { Close the file          }
       END.

See Also: Eof Eoln Read ReadLn SeekEof

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