ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange Binary File Write Behaviour

Solved!
Go to solution

Something a bit strange going on when I attempt to write data to a binary file. I've replicated the issue in StrangeBinaryFileBehaviour.vi which is attached below...

 

I'm merely writing two bytes to a binary file yet my hex editor/viewer is telling me I have 6 bytes of data, a screenie of the hex editor dump of the binary file is also attached

 

Maybe I'm losing the plot and am missing something, forgive it's late on a friday Smiley Tongue

 

Strokes

Download All
0 Kudos
Message 1 of 3
(2,541 Views)
Solution
Accepted by topic author Strokes

Wire a FALSE to the "prepend array or string size ...?" terminal. The default is TRUE so you get additional bytes, depending on what you wire.

 

For a 1D array, you would get 4 additional bytes for the array size (I32) and tha's what you are seeing.

Message 2 of 3
(2,537 Views)

@altenbach wrote:

Wire a FALSE to the "prepend array or string size ...?" terminal. The default is TRUE so you get additional bytes, depending on what you wire.

 

For a 1D array, you would get 4 additional bytes for the array size (I32) and tha's what you are seeing.


I can't tell you how many times that has bit me in the arse.  I understand why the default it TRUE, but I have yet to run into a case where I actually wanted it to be TRUE.



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 3 of 3
(2,528 Views)