07-18-2017 07:29 AM - edited 07-18-2017 07:44 AM
Hello LabView Community,
I am new using LabView and I have to make a program that reads a binary file. The binary file format is an String array of size 40. Every string has a reserved space of 81 bytes (Hence file size: 3240 Bytes). If I thought the reading correctly, I have to read the binary file by chunks of 81 bytes. However while running the VI I get Error 4 End of File encountered despite that the reading process has not reached the amount of bytes of the complete size of the file, Could someone tell me what I am doing wrong? You'll find the VI attached. Thzanks in advance for the answers.
Solved! Go to Solution.
07-18-2017 07:52 AM
1. You have a race condition due to the Value property nodes.
2. You keep increasing the number of bytes you are reading by 81 each iteration (you keep updating Count and using that value to tell the Read Binary File how many bytes to read).
3. You really need to close the file when you are done.
Since you state that there are 81 bytes per string, we can take the file size and divide by 81. That will tell us how many strings we need to read. Therefore, we can use a FOR loop. Inside the loop, just read 81 bytes (use U8), then Byte Array To String, and finally autoindex the resulting string to give us an array of strings.