Discussion:
Invalid character with DAQmxCreateTask
(too old to reply)
knicewar
2008-08-06 16:10:14 UTC
Permalink
I have a DLL that I wrote which uses NIDAQmx calls.  I've used NIDAQmxbase on Linux before, so I'm fairly comfortable with using the API.  What's new here is that I'm on Windows using MinGW (I'm using the CVI-created NIDAQmx.c method for resolving symbols).  When I try to create a task with "6224DIO/port0/line0" as the name, I get an error saying invalid character at position 7.  I've tried giving a different name like "mytask" but then that gives me an error saying the name is already in use -- no matter what I pick!  But that may be an unrelated problem.  With the original string that I want to use, it's as if it doesn't understand the '/'.  What am I doing wrong? In the off chance it's a MinGW problem, I'm installing MS Visual C++ 2008 Express to see if building my DLL with MSVC makes any difference (which I doubt).Thanks,Keith.
knicewar
2008-08-06 17:40:12 UTC
Permalink
BTW, I've created my DLL using MSVC now and I still have the same problem.
knicewar
2008-08-06 18:10:08 UTC
Permalink
OK, I've eliminated LabView from the equation.  I'm just running a simple C++ app calling NIDAQmx: ----#include <iostream>#include <NIDAQmx.h>using namespace std;int main(int argc,         char * argv[]){     cout << "create task '" << argv[1] << "'" << endl;    TaskHandle _task_handle;    int error = DAQmxCreateTask(argv[1],                                &_task_handle);    if (DAQmxFailed(error))    {        char error_buffer[2048] = {'\0'};        DAQmxGetExtendedErrorInfo(error_buffer,                                  sizeof(error_buffer));        cerr << error_buffer << endl;        return 1;    }    cout << "create task done" << endl;    DAQmxClearTask(_task_handle);    return 0;} ----Here's what I get:$ ./Debug/project3.exe 6224DIO/port0/line0create task '6224DIO/port0/line0'Measurements: Specified string is not valid, because it contains an invalid character.Position of Invalid Character: 7Invalid String: 6224DIO/port0/line0Task Name: 6224DIO/port0/line0Status Code: -200552What's going on here??  Am I not allowed to use the channel name as the task name?  I was able to do this with NIDAQmxbase ...
knicewar
2008-08-06 18:40:08 UTC
Permalink
Hm.  Apparently you can't use the channel name as the task name.  If I use a simple string with my console app, it works fine.  This is different behavior than with mxbase, but I can live with it ...
Loading...