Click or drag to resize

FEof Function

X#
Determine if the file pointer is positioned at the end-of-file.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION FEof(
	ptrHandle AS IntPtr
) AS LOGIC
Request Example View Source

Parameters

ptrHandle
Type: IntPtr
The handle of an open file.

Return Value

Type: Logic
TRUE if the file pointer is at end-of-file; otherwise, FALSE.
Remarks
Remarks
Tip Tip
The low level File IO functions in the X# runtime are using .Net filestreams in the background.
That means that the file handles returned by FOpen() and FCreate() are not 'normal' file handles, but unique identifiers that are used to find the underlying stream object in a collection of streams in the runtime.
That also means that you can't use file handles for functions such as FRead() and FWrite() that were not created in the X# runtime.
If you want to access the underlying FileStream, then you should call the function FGetStream(IntPtr)
Examples
This example checks for end-of-file after attempting to move 101 bytes:
X#
1LOCAL ptrHandle AS PTR
2ptrHandle := FOpen("docu.txt")
3FSeek(ptrHandle, 101)
4? FEOF(ptrHandle)
This example reads the entire file, one line at a time, until it reaches the end-of-file:
X#
1ptrHandle := FOpen2("docs.txt", FO_READ)
2IF ptrHandle != F_ERROR
3    DO WHILE !FEOF(ptrHandle)
4        ? FReadLine2(ptrHandle, 80)
5    ENDDO
6ENDIF
7FClose(ptrHandle)
See Also