ckh1 - 2022-08-25

Hello,
It seems that SysFile.SysFileGetStatus and SysFile.SysFileGetStatus2 never return FS_EOF.

The code below is the part of my program that should reads from a file until FS_EOF.
Using Codesys in debug mode, I have verified that all of the contents of the file are indeed being read, but even after all of the contents of the file have been read, and the call to SysFileRead is returning 0, the call to SysFileGetStatus2 continues to return FS_OK instead of FS_EOF...forever.

Am I attempting to use this incorrectly, or is there more I should be doing?
Any help would be greatly appreciated!
Thanks!

fileStatus := sysfile.SYS_FILE_STATUS.FS_OK;
WHILE(fileStatus <> sysfile.SYS_FILE_STATUS.FS_EOF) DO
    bytesRead := sysfile.sysFileRead(hFile, ADR(pbyReadBuf), SIZEOF(pbyReadBuf), pudiResult);
    fileStatus := sysfile.SysFileGetStatus2(hFile, pudiResult);
END_WHILE
 

Last edit: ckh1 2022-08-25