Showing results for 
Search instead for 
Did you mean: 

Error Code 6 "Generic file I/O error" when opening binary file dependent on data amount to be read?

Using LV8.5 FDS on WinXP SP2:


When using the "Read from binary file"-function I get the feeling that LabVIEW checks whether there is enough free memory available before actually reading the requested amount of data:

After calculating the number of DBLs saved in the file and connecting this value to the "count" input of the function I get error 6 "Generic file I/O error". If I use a different, considerably smaller number of counts the funtion proceeds just fine

Could anyone please definitely confirm or definitely deny my assumption rather than guess which is what I am doing here already...


Thanks a lot.




PS: I used the attached VI, LV version 8.5

Message 1 of 9

How large is the binary file you are trying to read?  What created it?  Does it have any data appended to the beginning of it such as a few bytes indicating the number of data points?


I think you may have issues with your use of the file size to calculate the number of records.  Look at the Read Binary File example.  It uses the function Get File Size to calculate how many bytes to pull and not the File/Directory Info function you are using.


Also use the data type I32 for all your calculations and not I64.  I64 is a huge potential number, much larger than the potential file size.  And it is forcing a coercion to I32 which is what the Read function is expecting.

Message 2 of 9

First my apologies for not having answered in 2 weeks - I was ill, sorry about that.

Thanks for your answer.


Concerning your questions on the file:

1. File size is roughly 220 MB

2. The file was created with LabVIEW 8.5 during a measurement of 3 channels and 8192 data points per channel and acquisition loop count. The data was written as 2D-DBL array with 3x8192 values at a time (data amount of 1 acqusition loop count)

3. There is no header, the file only contains the data.


About your suggestions to solve the problem:

1. Using Get File Size instead of File/Directory Info had no other result.

2. Staying straight on I32 numbers for the COUNT input did not change the outcome of running the VI.


Things I also tried:

1. COUNT = -1 --> same error occurs

2. Read Binary Data example didn't work with the file in question either, yielding the same error.

3. Data amount up to 8.384.502 DBLs can be read, which is roughly 65 MB --> lack of memory cannot be the cause of the error

4. Attempt to WRITE such an amount of data in form of one DBL array containing 9.000.000 values using Write Binary Data example failed as well!


It therefore seems to me that there is a "size bug" in the binary file functions. Any idea still?

Message 3 of 9

comrade wrote:


2. The file was created with LabVIEW 8.5 during a measurement of 3 channels and 8192 data points per channel and acquisition loop count.


What are you using to carry out the measurements?  Is it an instrument that communicates with the PC via GPIB?

If so, this error can occur when you send another command to an instrument before either reading the result of the last command or waiting for the command to finish. 

If you are using GPIB, do you have more than one instrument on the GPIB bus, or are you talking to the instrument from more than one place in the code? 


The reason for asking about GPIB is that typically, error code 6 means that an IO operation was aborted.


Message 4 of 9
I used a PXI system to record the data. Furthermore the error occurs during offline file handling from/to hard disk. Streaming of the data while measuring worked just fine.
0 Kudos
Message 5 of 9



are there any more hints someone can share about this problem? I appreciate any kind of clue. Thanks.

0 Kudos
Message 6 of 9
Can you post the code?
0 Kudos
Message 7 of 9
What code other than the one in the first post (--> do you need?
0 Kudos
Message 8 of 9

I tested seems LabVIEW doesn't like the way I wrote the measurement files. I attached a set of VIs (ZIP-file) to give you a clue how it was done. When I try to save and read a file containing just plain DBLs from a 1D-Array (see attached file generating VI) it works perfectly well for large file sizes.


So there might get something messed up by the way LabVIEW saved the measured data. You'll notice, that I (accidentally) left the "prepend array string size" input of "write to binary file" function unwired which means that the size information will be written as a type of header. Maybe this is the reason that it doesn't work as expected...

Download All
0 Kudos
Message 9 of 9