NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

errorMsg[1024]: Getting buffer size programmatically

I am using TestStand 3.5 and LabWindows/CVI 8. The prototypes for my functions callled from TestStand look like this:
"void __declspec(dllexport) __stdcall myFunc (short *errorOccurred, long *errorCode, char errorMsg[1024])"

It is nice to be able to pass errorMsg as a fixed size array, as opposed to just a pointer, so the burden or allocating/deallocating memory is removed from me.  The size of the buffer (1024) is defined in the sequence editor and I can generate the prototype and code for my function, but it seems that the two are somewhat seperate. By that I mean that I can change the literal number in either place and get them not to agree (accidently).
It would be nice if could specify the 1024 buffer size in the TestStand sequence editor (as I am doing now), and then have this buffer and the buffer size passed down to my function.  So, I'd like to have my  function  read  "... char errorMsg[], int  errorMsgBuflen ... ". Or , alternatively, is there some property/function call that I can make to get the size of the errorMsg Buffer?

While I have your "ears", is there anything magical about 1024 for the buffer size? That seems to be the number I've seen used in all of the examples.

Thanks
Don Frevele


0 Kudos
Message 1 of 2
(2,945 Views)
Hi Don,
 
I've attached an example of passing in the array length of errorMsg from TestStand into a CVI dll.  There is nothing magical about the size of 1024.  It sets the maximum length of the error message. 
Cheers,

David Goldberg
National Instruments
Software R&D
0 Kudos
Message 2 of 2
(2,925 Views)