Difference between revisions of "Basic Pascal Tutorial/Chapter 2/EOLN and EOF"

From Lazarus wiki
Jump to navigationJump to search
m (bypass language bar/categorization template redirect [cf. discussion])
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{Basic Pascal Tutorial/Chapter 2/EOLN and EOF}}
 +
{{TYNavigator|Chapter 2/Files|Chapter 2/Programming Assignment}}
 +
 
2E - EOLN and EOF (author: Tao Yue, state: unchanged)
 
2E - EOLN and EOF (author: Tao Yue, state: unchanged)
  
 
<tt>EOLN</tt> is a Boolean function that is <tt>TRUE</tt> when you have reached the end of a line in an open input file.
 
<tt>EOLN</tt> is a Boolean function that is <tt>TRUE</tt> when you have reached the end of a line in an open input file.
<delphi>
+
 
 +
<syntaxhighlight lang=pascal>
 
eoln (file_variable)
 
eoln (file_variable)
</delphi>
+
</syntaxhighlight>
  
 
If you want to test to see if the standard input (the keyboard) is at an end-of-line, simply issue <tt>eoln</tt> without any parameters. This is similar to the way in which <tt>read</tt> and <tt>write</tt> use the console (keyboard and screen) if called without a file parameter.
 
If you want to test to see if the standard input (the keyboard) is at an end-of-line, simply issue <tt>eoln</tt> without any parameters. This is similar to the way in which <tt>read</tt> and <tt>write</tt> use the console (keyboard and screen) if called without a file parameter.
<delphi>
+
 
 +
<syntaxhighlight lang=pascal>
 
eoln
 
eoln
</delphi>
+
</syntaxhighlight>
  
 
<tt>EOF</tt> is a Boolean function that is <tt>TRUE</tt> when you have reached the end of the file.
 
<tt>EOF</tt> is a Boolean function that is <tt>TRUE</tt> when you have reached the end of the file.
<delphi>
+
 
 +
<syntaxhighlight lang=pascal>
 
eof (file_variable)
 
eof (file_variable)
</delphi>
+
</syntaxhighlight>
  
 
Usually, you don't type the <tt>end-of-file</tt> character from the keyboard. On DOS/Windows machines, the character is <tt>Control-Z</tt>. On UNIX/Linux machines, the character is <tt>Control-D</tt>.
 
Usually, you don't type the <tt>end-of-file</tt> character from the keyboard. On DOS/Windows machines, the character is <tt>Control-Z</tt>. On UNIX/Linux machines, the character is <tt>Control-D</tt>.
  
{|style=color-backgroud="white" cellspacing="20"
+
{{TYNavigator|Chapter 2/Files|Chapter 2/Programming Assignment}}
|[[Files|previous]] 
 
|[[Contents|contents]]
 
|[[Programming_Assignment_2|next]]
 
|}
 

Latest revision as of 15:18, 20 August 2022

български (bg) Deutsch (de) English (en) français (fr) 日本語 (ja) 中文(中国大陆)‎ (zh_CN)

 ◄   ▲   ► 

2E - EOLN and EOF (author: Tao Yue, state: unchanged)

EOLN is a Boolean function that is TRUE when you have reached the end of a line in an open input file.

eoln (file_variable)

If you want to test to see if the standard input (the keyboard) is at an end-of-line, simply issue eoln without any parameters. This is similar to the way in which read and write use the console (keyboard and screen) if called without a file parameter.

eoln

EOF is a Boolean function that is TRUE when you have reached the end of the file.

eof (file_variable)

Usually, you don't type the end-of-file character from the keyboard. On DOS/Windows machines, the character is Control-Z. On UNIX/Linux machines, the character is Control-D.

 ◄   ▲   ►