Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear and stop Task functions

Hi group,
 
Could anyone explain to me how do stop and clear functions work, Because after using them I am still able to get the task name and the taskhandle, I did this test:on timer 6602
 

int32 StopTask()

{   int32 error=0;

char *data;

    data=

new char[20];

    DAQmxGetTaskName(CO_handle, data, 20);

    printf("Before stopping: Taskname=%s, taskhandel=%d\n",data,CO_handle);

    error=DAQmxStopTask (CO_handle);

   if (error !=0)    printf("StopTask error=%d\n",error);

   error=DAQmxClearTask(CO_handle);

   DAQmxGetTaskName(CO_handle, data, 20);

   printf("After clearing: Taskname=%s , taskhandel=%d error=%d\n",data,CO_handle,error);

return error;}

 

The output was:

Before stopping: Taskname=TIMER  , taskhandel=360120584
StopTask error = 0
After clearing:  Taskname=TIMER  , taskhandel=360120584 error=0

I find this output strange a little bit, I thought clearing the task means destroying it from the memory, but it seams not. This causes problems because in my project I need to stop (and clear) the task and recreate it many times, it sometimes works, but in some cases I got a message "the task is already used" although I had stopped and cleared it.

Best regards

Amna

0 Kudos
Message 1 of 1
(3,384 Views)