Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS File library in c++

Solved!
Go to solution

Hello

 

I acquired data with a labview program, I recorded this data on the TDMS files, and now I want to process the data in c. I cannot find the path to the files in the TDMSFile library; how can I add this library to my project in visual studio?
Thank you in advance for your answer ?

0 Kudos
Message 1 of 2
(698 Views)
Solution
Accepted by topic author ameletudiante99
To access and process TDMS files in your C project, you'll need to use the TDMS File Format library (or API). Here’s a step-by-step guide on how to incorporate it into your project:
 
1. Download the Necessary Libraries:
   - NI TDMS DLLs: National Instruments provides DLLs for TDMS file manipulation. Ensure you have the NI DataPlugins toolkit or the necessary libraries. You might need to install NI software like LabVIEW or DIAdem to access these libraries.
   - Alternatives: You can also use third-party libraries like `tdms_reader`, which provides a C-compatible solution.
 
2. Include the DLL in Your Project:
   - Place the DLL (e.g., `Nilibddc.dll`, `Nilibdc.dll`, etc.) in your project folder or a suitable location.
   - Add the DLL directory to your project's search paths in Visual Studio.
 
3. Link to the DLL:
   - In Visual Studio, go to `Project > Properties`.
   - Navigate to `Configuration Properties > Linker > General`.
   - Add the DLL path under `Additional Library Directories`.
 
4. Include the Headers:
   - Alongside the DLL, make sure you have the header files (e.g., `Nilibddc.h`).
   - Include these in your project using `#include "Nilibddc.h"`.
 
5. Write Your C Code:
   - Use the TDMS API functions defined in the header to read, parse, and manipulate TDMS data. The function calls will depend on the specific API you're using.
   - If the TDMS API provides C-style function definitions, ensure you use the right data types.
 
6. Build and Test:
   - Ensure the program builds correctly by confirming that the linker resolves all symbols.
   - Test with sample TDMS files to verify correct data parsing.
 
Example with NI TDMS API:
 
Assuming the appropriate header files and DLLs are available:
 
 
#include "Nilibddc.h"
int main() {
    DDCFileHandle fileHandle = 0;
    DDCError error = DDC_OpenFile("your_data_file.tdms", "", &fileHandle);
    if (error != DDC_NoError) {
        // Handle errors
    }
    // Process data with other API functions
    DDC_CloseFile(fileHandle);
    return 0;
}
```
 
 
 
 
Make sure to check National Instruments' documentation or any third-party library documentation for specific function calls and usage patterns.
0 Kudos
Message 2 of 2
(638 Views)