LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
QFang

preallocated write to binary file

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

A great new VI is available in the advanced file IO:  Preallocated Read from Binary file!

 

Unfortunately, it is missing its twin: Preallocated write to binary file!

 

It would be great if a similar VI was available that I could write e.g. a U8 array in on the left side, have it dumped to binary file, and come out the other side without creating a memory copy of that array.  This would be useful in a number of cases where you want to keep working with the data you dumped to file.

QFang
-------------
CLD LabVIEW 7.1 to 2016
4 Comments
AristosQueue (NI)
NI Employee (retired)

What do you mean "without creating a memory copy of that array"? Write Binary File doesn't duplicate the array.

QFang
Active Participant

I was being educated on a related topic yesterday here on the forums, regarding things like 'subarray' and how branching an array wire does not automatically create a copy of the data on that wire.. I guess that is one of those things that is true in 90+% of the cases, but has some notable exceptions. <br>So two things made/make me think/worry that a copy is made: <br>1) Show buffer allocations shows a dot on the write binary input terminal (but show buffer does not automatically mean a whole copy is made, though in this case, context help of the array wire going to the binary write says 'array' not 'subarray'). <br>2) The wire is branched, and changes are made to the 'main wire' AFTER the binary write (though the compiler may or may not be pick up on that, probably does). <br><br>So, considering how easy it is to be wrong on the above 1) and 2), I'm left with "make a pre-allocated write binary so that I can wire my array in a straight line out the back and not introduce wire-bends" .... which is not really a very strong case for a "new" function. 😛

QFang
-------------
CLD LabVIEW 7.1 to 2016
AristosQueue (NI)
NI Employee (retired)

Branching the wire will cause a copy if the other branch is stomping on the value. No amount of changing the the Write node will change that. The Write node is an asynchronous node, so it needs its own copy of the data that isn't being stomped on while it works. That's the branch, not the node.

 

I'm going to close this idea.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.