Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiUInt16Vector problem

I am new to Measurement Studio, and am trying to get a Graph into my dialog. I got hte control on the dialog tool bar, and onto the dialog, went and added a control variable with the Class Wiizard... now I want to plot some data, and I get errors during compiles from the following:
 
 unsigned char *buf;
...
 buf = new unsigned char[xfer_len];
...
for(...
  len = m_xem->ReadFromPipeOut(0xb1, pkt_len, buf+(pkt_len*i));
...
 m_CNiGraphCtrl1.PlotY( (CNiUInt16Vector)buf);
0 Kudos
Message 1 of 2
(3,084 Views)

You can do something like this instead

CNiUInt8Vector databuff(xfer_len); //create vector of unsigned chars, Uint16 would be shorts. The following code would work the same with a CNiUint16Vector.

unsigned char *test = (unsigned char*)databuff; //get pointer to underlying data buffer

for(...
  len = m_xem->ReadFromPipeOut(0xb1, pkt_len, buf+(pkt_len*i));
...

m_CNiGraphCtrl1.PlotY(databuff);

No need to call free. databuff will be free'ed automatically.

And please try to limit one post per issue. 10 posts for the same problem just ends up cluttering the forums.
Thanks.


Message Edited by bilalD on 02-10-2006 08:57 AM

Bilal Durrani
NI
0 Kudos
Message 2 of 2
(3,084 Views)