LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS DLL

Solved!
Go to solution

Hello,

 

I am trying to read a TDMS file in a Visual Studio C++ 2005 program.  I downloaded the DLL from http://ni.intellisurvey.com/run/2007codelicenseagree and attempted to run the example program: readfile.c

 

I got an error when attempting to open the file: -6211 described as "The storage could not be opened."   

 

This happens with my files and others that I found on these forums.

 

The open call the test program uses is marked as obsolete in the header so I changed it to use the new open call DDC_OpenFileEx()  but got the same results.  I also tried varying the arguments by passing null, "TDMS", or "TDM"  for the file type and/or passing 0 / 1 for the readOnly flag without success.

 

I believe I'm using the DLL properly as calls to DDC_GetLibraryErrorDescription() work.

 

I found that this problem has been reported on these forums before but didn't have a solution:

http://forums.ni.com/ni/board/message?board.id=170&message.id=286903&query.id=86898#M286903

 

Any ideas?

 

0 Kudos
Message 1 of 13
(9,633 Views)

Hello Curt,

Thank you for posting on the NI Discussion Forums.  Running the example out of the box, I had to change line 26:

 static const char * FILE_PATH       = ".\\sampleFile.tdm";

 

to point to a different path, because “sampleFile.tdm” was nowhere to be found in the download (at least not for me, unfortunately).  After pointing to an existing TDM file on my machine, the example “readFile.c” ran without error for me. 

I was able to replicate the error message that you receive “The storage could not be opened” by changing the Security Preferences of the file to deny read privileges to my username on my machine.  These privileges can be changed by the machine’s administrator account by right-clicking on the file, and selecting Properties.  In the file properties dialog window, select the Security tab to see the security preferences of a given file for specific users by selecting a user.  Check to see if you are allowed reading access to the TDM file or not.  If you are not allowed those privileges, log on as the administrator and allow those privileges for your account.

Another possible cause for this error could be that the file is in use by another program at the time you are trying to access it.

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 2 of 13
(9,604 Views)

Hello,

 

I still haven't had success yet.

 

I'm sure I'm actually reading the desired TDMS files.  It does create a matching .tdms_index file.  If I pass in an invalid filename I get a different error message (-6209) and if I pass in a non-TDMS file I get the same error message (-6211) except that the .tdms_index file isn't created.

 

These files are readable and writable as I can modify them with other software and I don't think they are in use or busy as a reboot doesn't help.

 

Maybe this DLL doesn't support the version of TDMS files I'm using?  I'm using DLL version 8.6 but not sure what version the TDMS files are as I'm not creating them.  I'll have to look into that.

 

What version does this DLL support?

 

0 Kudos
Message 3 of 13
(9,584 Views)

Hello CurtS,

 

As far as I'm aware, there are no different versions of TDMS, just TDM and TDMS file formats (which are slightly different).  Besides the suggestions posted above, I'm really not sure what else to look for.  Would you mind posting one of the problematic files (along with its index (.tdx) file) so that I could try it out on my end?

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 4 of 13
(9,556 Views)

Hello,

 

I can't give you my files but I have tested against other TDMS files I found on this forum.  I had the same problem with: http://forums.ni.com/ni/board/message?board.id=180&message.id=33787&query.id=166045#M33787

 

When I attempt to open the testtdms.tdms with the readfile program it does create a testtdms.tdms_index that is byte for byte equal to the index file within the zip file.

0 Kudos
Message 5 of 13
(9,552 Views)

CurtS,

 

What TDMS files are you referring to in the forum linked above?  I do not see any TDMS files posted.  Please let me know, or just post them to this forum so that I can get a hold of them and try it out.

 

As I mentioned before, I believe that there is something wrong with the permissions or file settings, since I am able to read the files just fine with the same downloaded code.

Chris_G
Sr Test Engineer
Medtronic, Inc.
0 Kudos
Message 6 of 13
(9,505 Views)

I went ahead and attached it here: samples1.zip.  It has the file: testtdms.tdms.

 

I can't read this file with the DLL (error -6211) but does produce the testtdms.tdms_index file that is identical to the one in the zip file.  I can read this .tdms file successfully with other tools.

0 Kudos
Message 7 of 13
(9,501 Views)

CurtS,

Attached are some screen shots of successful runs with the DLL, and the exact TDM and TDMS files from the zip file you attached to your last post.  Have you modified the code from the download in some way?  Perhaps a modification has changed the behavior to receive this error.

All I did (as seen in the screen shots) was change the path to a file that I would like to read, and make sure that the DDC Open File command has the correct file format in it (either TDM or TDMS, depending on what I’m reading).

Is it possible for you to post your code (or a slimmer version of it) on this forum for me to try out?  Perhaps I am doing something slightly different that we are not taking into account right now.

 

Chris_G
Sr Test Engineer
Medtronic, Inc.
Download All
0 Kudos
Message 8 of 13
(9,474 Views)
Solution
Accepted by topic author CurtS

 

I'm trying to get the test program that came with the DLL to work.  I am using Visual Studio C++ 2005 and did have to change it a bit to get it to work.

 

Does this DLL work with Visual Studio 2005?  Has anyone gotten this to work with Visual Studio 2005? 

 

Maybe there is something I configured incorrectly?  I'm not sure what it could be as it seems to calling the DLL routines.  Maybe it is something to do with my environment?  I tried this on three different machines - all running Window XP.

 

I attempted to attach my project but it was too big.  What is the size limit here?  Is there somewhere else I could post it?

 

Again,

I'm sure this program is reading the .tdms file: It generates a valid .tdms_index (but returns the -6211 error code and zero for file handle)
I'm sure I'm configuring the Open command with the correct file type - if I use "TDMS" it generates a .tdms_index, if I use "TDM" it generates a testdms.tdms.log with describing an exception and if I pass anything else I get an invalid argument error.


Pointing correctly to testtdms.tdms the output is:

Error: The storage could not be opened.
End of program, press Enter key to quit

 

 

I went ahead and attached the modified test program source code.

0 Kudos
Message 9 of 13
(9,454 Views)

Hello CurtS,

 

The first thing that I wanted to verify with you is that  you have the file usiPluginTDM.dll in the same location as nilibddc.dll. This is a dependancy that is necessary to correctly read the tdms files, and if it is in a location that can't be found, you will experience exactly the behavior you have described (Storage could not be opened, index file still generated, etc).  

 

If you are sure that you have this dependancy in the correct location, would you please try opening and running the attached VC2005 solution?  This is the code I have done testing with, and it reads the aforementioned TDM and TDMS files without any problem.  It is essentially the same code that is downloaded from the site you mentioned, again with a few tweaks to get it to work in Visual Studio.  Please let us know if it continues to give you trouble.  Thanks!

 

NickB

National Instruments 

Message Edited by nickb on 10-24-2008 05:53 PM
0 Kudos
Message 10 of 13
(9,411 Views)