1.2.7.4.13 SYS_FS_FileEOF Function

C

bool SYS_FS_FileEOF
(
    SYS_FS_HANDLE handle
);

Summary

Checks for end of file.

Description

Checks whether or not the file position indicator is at the end of the file.

Precondition

A valid file handle must be obtained before knowing a EOF.

Parameters

ParamDescription
handlefile handle obtained during file Open.

Returns

On success - returns true indicating that the file pointer has reached the end of the file.

On failure - returns false. This could be due to file pointer having not reached the end of the file. Or due to an invalid file handle. The reason for the failure can be retrieved with SYS_FS_Error or SYS_FS_FileError.

Example

SYS_FS_HANDLE fileHandle;
bool eof;

fileHandle = SYS_FS_FileOpen("/mnt/myDrive/FILE.txt", (SYS_FS_FILE_OPEN_READ));

if(fileHandle != SYS_FS_HANDLE_INVALID)
{
    // File open is successful
}
...
...

eof = SYS_FS_FileEOF(fileHandle);

if(eof == false)
{
    // Check the error state using SYS_FS_FileError
}

Remarks

None.