06-30-2014 10:44 AM
Thank you nathan, will try to implement your ideas, and see how it goes.
~nsn
12-03-2017 01:32 AM
Hi, While searching the forum for a working example using the DSNewPtr and MoveBlock functions, I came across Nathan's ReadWDF.vi. I'm not sure if it conains a bug because it pre-allocates an array of half the number of bytes allocated by DSPtrNew. If so, is that a problem for MoveBlock?
12-03-2017 05:25 AM
Not sure exactly which code you're referring to, and I'm posting from a mobile device so I can't look at it any VIs right now, but if you're seeing a mismatch between Initialize Array and DSNewPtr, it's because the former is a number of elements (where the array element can be more than one byte) and the latter is a number of bytes. Initializing an array of U16 creates an array of twice that many bytes because each U16 is 2 bytes.
12-03-2017 03:56 PM
Hi Nathand,
Please look at the code you posted.
X * 4 = 4X bytes allocated by DSNewPtr.
X * 2 (2 bytes per I16) = 2X bytes of array space.
fdewit noted that your example "kept crashing".
(The problem is corrected in other examples in this thread.)
Please note that this is not to be "critical"!
I benefit from your contributions and hope you keep-up the good work!
12-04-2017 12:28 PM
You're right! Pity it took 6+ years for someone to point out the error (although I'm glad to hear it got corrected in the VIs from people who actually needed the code), but it's also nice to know that 6+ years later the code is still helpful as an example.