DAQmxCreateTask

NI-DAQmx C Functions

DAQmxCreateTask

int32 DAQmxCreateTask (const char taskName[], TaskHandle *taskHandle);

Purpose

Creates a task . If you use this function to create a task, you must use DAQmxClearTask to destroy it.

If you use this function within a loop, NI-DAQmx creates a new task in each iteration of the loop. Use the DAQmxClearTask function within the loop after you finish with the task to avoid allocating unnecessary memory.

Parameters

Input
Name Type Description
taskName const char [] Name assigned to the task.
Note This name may be changed internally. If you are using the C API, call DAQmxGetTaskName to verify whether the name was changed during creation. If you are using the CVI API, call DAQmxGetTaskAttribute with attribute ID DAQmx_Task_Name to verify the name change.
Output
Name Type Description
taskHandle TaskHandle * A reference to the task created in this function.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.