LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a c structure from teststand?

I need to get a C struct from TS.  I have the path of the container stored in a string.  I get the string (holds the path to the container).  I then tried to get the structure using "TS_PropertyGetValVariant", but this does not seem to work.

Here is the code:

 

 char *  pString;
 int iStatus = -1;
 ERRORINFO   sErrorInfo;
 VARIANT tmpVariant = CA_VariantEmpty();
    double *numArray = NULL;
 
  TS_PropertyGetValString (  seqContextCVI,
        NULL,
        "Step.PathToStructureResponse",
        TS_PropOption_InsertIfMissing,
        &pString);
 
 iStatus = TS_PropertyGetValVariant (seqContextCVI, NULL, pString, 0, (VARIANT*) &tmpVariant);
 
 CA_DisplayErrorInfo (seqContextCVI, "Error", 0, &sErrorInfo);
  
 CA_FreeMemory(pString);

 

Note:

pString holds "RunState.Sequence.Main["TS_Sched"].Structure"

 

Any Ideas?

 

0 Kudos
Message 1 of 2
(3,823 Views)

Hi goslow,

 

I'd like to confirm exactly what you are trying to do.  Let me know if the following is not accurate.

 

1. You have a container in TestStand

2. You have a struct within your CVI code

3. You would like to pass the container into the CVI code as a struct

4. You would like to do some manipulation on the container you passed in from TS (now a struct), setting values from the pre-defined struct in your CVI code

 

I'd like to make sure this is what you're doing before I recommend anything.  Since you are definitely passing a container to CVI, I'd like you to make sure you have prepared the container to be passed to CVI as a struct.  In your Types Palette, right-click on the container and select Properties.  Check the C Struct Passing tab and make sure that you have these settings to match your CVI environment.



We also have a shipping example which demonstrates how to pass a TestStand container as a C style struct to a function in a DLL.  This example can be found in your <TestStand>\Examples\StructPassing\C folder.  Look forward to your next post! 

Message Edited by RT4CY on 12-03-2008 10:09 AM
Rod T.
0 Kudos
Message 2 of 2
(3,770 Views)