Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Datasocket: Get 2D text Array from DSS

Measurement Studio 8.x with VS C++ 2003
 
 
Hey, how can I get an 2D text array from a datasocket server. I know how to get simple values from a DS with Measurement Studio, but I'm not able to get the 2D text array. What typ of variable should I choose to convert the CNiDataSocketData?
 
(I have VI which shows me the 2D-Array so it's only a problem with my code and not with transfer...)
 
Thanks for your help!
0 Kudos
Message 1 of 2
(6,350 Views)
Hi AnTri,

to convert the CNiDataSocketData you should choose the CNiVariant and the SAFEARRAY datatype.
Take a look at the following sourcecode:

CNiDataSocketData data

CNiVariant vVariant(data); //CNiDataSocketData to CNiVariant
SAFEARRAY * safearray;
BSTR pString;
CString cString;
long lIndex[2];

lIndex[0] = 0;
lIndex[1] = 0;
safearray = vVariant.parray; //get the safearray from CNiVariant
SafeArrayGetElement(safearray, (long*)&lIndex,(void*)&pString); // get element from safearray
cString = pString;


Best regards,

Benjamin
0 Kudos
Message 2 of 2
(6,310 Views)