When I close the application, the hardware is still output Voltage 'val' .How to stop this ao task and writer?
Code as follows:
//////////////////////
try
{
CNiDAQmxTask task(_T("AOTask"));
task.AOChannels.CreateVoltageChannel(
physicalChannel,
_T("AOChannel"),
min,
max,
DAQmxAOVoltageUnitsVolts);
CNiDAQmxAnalogSingleChannelWriter writer(task.Stream);
writer.WriteSingleSample(true, val);
}
catch(CNiDAQmxException *e)
{
e->ReportError();
e->Delete();
}