NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
simon27
Posts: 24
0 Kudos
Accepted Solution

cannot open tdms file

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++)

 

Member
Bo_Xie
Posts: 53
0 Kudos

回复: cannot open tdms file

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

Member
simon27
Posts: 24
0 Kudos

回复: cannot open tdms file

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

 

Here attachemnt of the TDMS file

Member
simon27
Posts: 24
0 Kudos

回复: cannot open tdms file

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

 

Here attachemnt of the TDMS file

Member
simon27
Posts: 24
0 Kudos

回复: cannot open tdms file

Still need your help...

:smileyhappy:

Member
simon27
Posts: 24
0 Kudos

回复: cannot open tdms file

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

Active Participant
Perry_S
Posts: 204
0 Kudos

回复: cannot open tdms file

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
Member
simon27
Posts: 24
0 Kudos

回复: cannot open tdms file

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.

 

Active Participant
Perry_S
Posts: 204
0 Kudos

回复: cannot open tdms file

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
Active Participant
Perry_S
Posts: 204
0 Kudos

回复: cannot open tdms file

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
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page