LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

EOF Error while reading binary file

Solved!
Go to solution

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.

0 Kudos
Message 1 of 2
(3,653 Views)
Solution
Accepted by topic author AnaZerpa

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 2
(3,638 Views)