You need to define a gc array in order to use it with the managed code. Try this
int i = 0;
Task *DIOWTask = new Task ("DigitalWriteTask");
bool dataArray __gc[] = new bool __gc[8]; for (i=0; i<8; i++)
{
if ((i%2) == 0)
dataArray [i] = true;
else
dataArray [i] = false;
}
DIOWTask->DOChannels->CreateChannel ("Dev1/Port0/Line0:7",
"Port0", ChannelLineGrouping::OneChannelForAllLines);
DigitalSingleChannelWriter *writer = new Dig
italSingleChannelWriter (DIOWTask->Stream);
writer->WriteSingleSampleMultiLine (true, dataArray);
This worked for me.
For the second part, try changing the channelgrouping to OneChannelForEachLine so that you're specifying a single line
Make sure to handle any DAQExceptions with a try/catch blocks also.
Bilal
Bilal Durrani
NI