Difference between revisions of "EOF"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>SMcNeill
(style guidelines)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''EOF''' Function indicates that the end of a file has been reached.
+
The [[EOF]] function indicates that the end of a file has been reached.
 
 
  
  
 
{{PageSyntax}}
 
{{PageSyntax}}
:: DO WHILE [[NOT]] EOF(filenumber&)
+
: {{Parameter|endReached%%}} =  EOF([#]{{Parameter|fileNumber&}})
  
  
* Filenumber is the number of the file being read. # is not required.
+
{{PageDescription}}
 +
* {{Parameter|fileNumber&}} is the number of the file being read. '''#''' is not required.
 
* Returns 0 until the end of a file. This avoids a file read error.
 
* Returns 0 until the end of a file. This avoids a file read error.
* Returns -1 at the end of the file.
+
* Returns -1 (true) at the end of the file.
* [[CHR$]](26) can be used to denote the end of a file.
+
<!-- confusing statement; further details are required: * [[CHR$]](26) can be used to denote the end of a file. -->
 +
* '''Note that [[GET]] can return invalid data at the end of a file.''' Read [[EOF]] after a GET operation to see if the end of the file has been reached and discard last read.
  
  
''See also:''
+
{{PageSeeAlso}}
 
* [[OPEN]]
 
* [[OPEN]]
 
* [[LOF]], [[LEN]]
 
* [[LOF]], [[LEN]]

Latest revision as of 17:44, 19 September 2017

The EOF function indicates that the end of a file has been reached.


Syntax

endReached%% = EOF([#]fileNumber&)


Description

  • fileNumber& is the number of the file being read. # is not required.
  • Returns 0 until the end of a file. This avoids a file read error.
  • Returns -1 (true) at the end of the file.
  • Note that GET can return invalid data at the end of a file. Read EOF after a GET operation to see if the end of the file has been reached and discard last read.


See also



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page