DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Read TDMS property using C++

hi all,

we are trying to read the TDMS property by using the TDM C DLL sample, copied the sample code below

// Reads the file
static int ReadFile (void)
{
int ddcError = 0, length;
DDCFileHandle file = 0;
char *property = 0;


// Read file name
ddcChk (DDC_OpenFileEx (FILE_PATH, "TDM", 1, &file));
ddcChk (DDC_GetFileStringPropertyLength (file, DDC_FILE_NAME, &length));
nullChk (property = 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 = malloc (length + 1));
ddcChk (DDC_GetFileProperty (file, DDC_FILE_DESCRIPTION, property, length + 1));


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

We are able to read the property length, but we need to read the value of wf_increment.
Any help on this is appreciable.

0 Kudos
Message 1 of 2
(3,401 Views)
double wf_increment = 0.0;
ddcChk (DDC_GetChannelProperty(channelsId, "wf_increment", &wf_increment, sizeof(double)));

is the code needed to read a double value. Be aware that there are channels that have no waveform properties.

0 Kudos
Message 2 of 2
(3,390 Views)