Error 4 End of File When Writing and Reading Binary Files in LabVIEW

Updated Aug 17, 2023

Reported In

Software

  • LabVIEW

Issue Details

I am trying to write and read binary files in LabVIEW and I am getting the following error: 

Error 4 occurred at Read from Binary File

Possible reason(s):
LabVIEW: End of file encountered.


Solution

This error occurs when you are trying to read a binary file but the file pointer is already at the end of the file. To fix this issue, we need to move the pointer back in the file so it has information to read. We can do this using the Set File Position VI in LabVIEW. Place this VI before the Read function to move the file pointer.