Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

cannot open tdms file

Solved!
Go to solution

Hi I'm using TDMS format to my project.

I succedd to log the whole data into TDMS file by using the 

DAQmxConfigureLogging(taskHandle, logFile.toAscii().constData() ,DAQmx_Val_LogAndRead,"GroupName",DAQmx_Val_OpenOrCreate)

 

Now my problem is that when I'm trying to read the TDMS file I can't open it.

 

My code of reading is (from the TDMStesing example):

     unsigned int

        length;
        int		ddcError = 0;
        DDCFileHandle	file = 0;
        char			*property = 0;

        // Read file name

        ddcChk (DDC_OpenFileEx (FILE_PATH, "TDMS", 1, &file));
        ddcChk (DDC_GetFileStringPropertyLength (file, DDC_FILE_NAME, &length));
        nullChk (property = (char*)malloc (length + 1));
        ddcChk (DDC_GetFileProperty (file, DDC_FILE_NAME, property, length + 1));

        printf ("File name property: %s\n", property);
        free (property);
        property = 0;

        // Read file description, if present
        if (DDC_GetFileStringPropertyLength (file, DDC_FILE_DESCRIPTION, &length) >= 0)
                {
                nullChk (property = (char*)malloc (length + 1));
                ddcChk (DDC_GetFileProperty (file, DDC_FILE_DESCRIPTION, property, length + 1));

                printf ("File description property: %s\n", property);
                free (property);
                property = 0;
                }

        // Read the channel groups
        ddcChk (ReadGroups (file));

Error:
        if (property)
                free (property);
        if (file)
                DDC_CloseFile (file);
        return ddcError;

 

When I debug the code I got the error code of -6204 at the DDC_OpenFileEx  function

 

Error details http://zone.ni.com/reference/en-XX/help/370051K-01/cvi/cvidiademlibraryerrors/

-6204 DDC_UnexpectedError An unexpected error occurred in the library.


Need help...

 

My setup:

Hardware: NI 9234
NI-Daqmx: device driver 9.4.0f5 
Windows version: XP (sp3)
Language: Qt (C++)

 

0 Kudos
Message 1 of 14
(8,664 Views)

simon27,

 

Could you check whether your tdms file is corrupted? If you have LabVIEW installed, you could open your tdms file using LabVIEW "TDMS File Viewer" (http://zone.ni.com/reference/en-XX/help/371361H-01/lvdialog/tdms_file_viewer_db/).

 

Best Regards,

Bo Xie

0 Kudos
Message 2 of 14
(8,657 Views)

I succedd to open it via Excel but not with C code.

 

Here attachemnt of the TDMS file

0 Kudos
Message 3 of 14
(8,652 Views)

I succeed to open it via Excel but not with C code.

 

Here attachemnt of the TDMS file

Download All
0 Kudos
Message 4 of 14
(8,651 Views)

Still need your help...

Smiley Happy

0 Kudos
Message 5 of 14
(8,575 Views)

Hi all,

 

I added the DataModels libs to the project and I succedd to read TDMS file.

 

BUT, now I'm trying to read TDMS 2.0 file and I got the next message:

 

 

ERROR: TDS Exception in Initialize: Tds Error: TdsErrFileVersionTooNew(-2510)


err id : -6210


 

Need help

 

Atteched the TDMS file

0 Kudos
Message 6 of 14
(8,569 Views)

Hi simon27,

 

What version of the DataModels library do you have? Which c development environment are you using? The error 6210 says that the file you are trying to open is read only. Did you have it open and tried to read from it?

 

Regards,

 

Perry S.

Applications Engineer

Applications Engineer
National Instruments
0 Kudos
Message 7 of 14
(8,548 Views)

Hi Perry S,

 

I realy don't know what version is the Data Models, I used the drivers from the TDMSTesting code that I found in the forum.

 

I succeed to open the file via excel and to read it.

 

I'm working on Qt 4.7 C++ enviroment

 

I attach the code example that I used for this testing.

 

0 Kudos
Message 8 of 14
(8,541 Views)

Hi Simon27,

 

Just to clarify, did you create this TDMS file? If not where did you get it? In which forum did you get the TDMS Testing Code? Could you place a link to it here? 

 

Regards,

 

Perry S.

Applications Engineer

Applications Engineer
National Instruments
0 Kudos
Message 9 of 14
(8,530 Views)

Hi Simon27,

 

Just to clarify, did you create this TDMS file? If not where did you get it? In which forum did you get the TDMS Testing Code? Could you place a link to it here? 

 

Regards,

 

Perry S.

Applications Engineer

Applications Engineer
National Instruments
0 Kudos
Message 10 of 14
(8,529 Views)