EOF: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Add information on HTTP handles)
No edit summary
Line 1: Line 1:
The [[EOF]] function indicates that the end of a file or HTTP response has been reached.
The '''EOF''' function indicates that the end of a file or HTTP response has been reached.




{{PageSyntax}}
{{PageSyntax}}
: {{Parameter|endReached%%}} =  EOF([#]{{Parameter|fileNumber&}})
: {{Parameter|endReached%%}} =  [[EOF]]([#]{{Parameter|fileNumber&}})
: {{Parameter|endReached%%}} =  EOF([#]{{Parameter|httpHandle&}})
: {{Parameter|endReached%%}} =  [[EOF]]([#]{{Parameter|httpHandle&}})





Revision as of 22:54, 6 January 2023

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


Syntax

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


Description

  • fileNumber& or httpHandle& is the number of the file or HTTP connected being read. # is not required.
    • fileNumber& is a file opened using OPEN.
    • httpHandle& is a HTTP connection opened using _OPENCLIENT.
  • 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.
    • This is not a problem when using EOF with HTTP connections with a variable length string, the string will always only contain valid data or be empty.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link