08-30-2012 08:35 AM
hi all,
I implemented a code (using the Labview example) to save and read cluster data (see attached file). The write part works properly but when I want to read the file, there is an error : "Error 4 occurred at Read from Binary File in main_save_data_V2.vi; LabVIEW: End of file encountered'.
BUT the data are correctly open. Why is there such message? any suggestions?
thank you.
Cedric
08-30-2012 08:40 AM
Did you check the size of the file? Can you please post the vi in 2009?
08-30-2012 08:44 AM
Plese post an image of the read code.
Error 4 EOF is normal when you read past the end of the file. If reading in a loop you toss the last value read when you get the error 4.
What eveidence do you have that the file is written correctly?
Ben
08-30-2012 08:45 AM
here is the file for Labview 2009.
Cedric
08-30-2012 09:04 AM - edited 08-30-2012 09:10 AM
Hi,
the problem seems to be the number of objects you tell the read binary vi to read. If I hardwire a constant of 1 to that input the error is no longer encountered. Read the help on the read binary vi - especially the part about that input.
You seem to think that one cluster of the type you are saving should be 8 bytes in size - since it contains arrays it may not even be possible to predict the size unless you KNOW how big those arrays always are.
If you knew that you always wanted to read a fixed amount of clusters you could work with that information.
Regards
Florian
08-30-2012 10:17 AM - edited 08-30-2012 10:18 AM
Instead of predicting how many clusters to read, just set the count in the binary read to -1. That will read all that it can and I got no error. Here is all you need in order to read the file.