LabWindows/CVI

TDMS_GetFileProperty

int TDMS_GetFileProperty (TDMSFileHandle file, const char *property, void *value, size_t valueSizeInBytes);

Purpose

Gets the value of a file property.

Parameters

Input
Name Type Description
file TDMSFileHandle The file handle. You obtain this handle from the TDMS_OpenFileEx, TDMS_CreateFileEx, TDMS_AdvancedOpenFile, or TDMS_AdvancedCreateFile function.
property const char * The name of the file property. You can specify a built-in property, virtual property, or a property created by TDMS_SetFileProperty. Virtual properties are special properties that are not saved in the .tdms file, but they can be used to perform certain actions.

The following built-in properties are available:

Property Constant Data Type
Name TDMS_FILE_NAME String (char *)
Description TDMS_FILE_DESCRIPTION String (char *)
Title TDMS_FILE_TITLE String (char *)
Author TDMS_FILE_AUTHOR String (char *)


The following virtual properties are available:

Property Constant Data Type Description
NI_DiskCacheSize TDMS_NI_DISK_CACHE_SIZE unsigned int You can use the NI_DiskCacheSize property to improve .tdms data writing performance by allocating a specific amount of cache size in memory for data. This property is valid only when the file was opened with the TDMS_OpenFileDisableBuffering option. The default value for this property is approximately 2 MB. A greater value for the NI_DiskCacheSize property usually can improve the writing performance; however, a greater value also requires more computer resources.
NI_DiskGapSize TDMS_NI_DISK_GAP_SIZE unsigned int You can use the NI_DiskGapSize property to improve .tdms data reading performance when reading discontinuous data. This property is valid only when the file was opened with the TDMS_OpenFileDisableBuffering option. The value of the NI_DiskGapSize property is a multiple of the sector size of the local hard disk. The default value for this property is 10. If the data gap in the .tdms file is less than the value of the NI_DiskGapSize property, the TDMS read functions can read all data from the file at one time. If the data gap in the .tdms file is greater than the value of the NI_DiskGapSize property, the TDMS read functions read each piece of data one at a time until it finishes reading all data.
Note Note  Obtaining the optimal reading and writing performance is a trial-and-error process. The same configuration might not return the same optimal performance on different computers. You might need to adjust the property values after you deploy an application from one computer to another.
NI_MinimumBufferSize TDMS_NI_MINIMUM_BUFFER_SIZE unsigned int Use this property to reduce the size of a .tdms file by controlling the number of times the data is written to disk.
NI_InMemoryWriteBlockSize TDMS_NI_IN_MEMORY_WRITE_BLOCK_SIZE long long This property is used to allocate the block size in memory for writing the data. The default value for this property is 10 MB. The valid value range for this property is [1KB, 1GB]. A greater value for this property usually can improve in-memory reading performance by allocating less blocks; however, an unnecessarily great value also requires more computer resources. This property must be set before the actual writing process otherwise an error will be returned. If you set this property multiple times, only the latest one will take effect.
valueSizeInBytes size_t The size in bytes of the memory location specified by the value parameter.

For example, if the attribute you are getting is of type string, pass the size of the string buffer you are passing for the value parameter. If the attribute you are getting is of type double, pass the size of a double: sizeof(double).

If the value you pass for this parameter is less than the size required for a string attribute, the value of the string attribute that you get will be truncated but still contains the terminating NUL byte.
Output
Name Type Description
value void * The pointer that receives the value of the specified file property. The type of this pointer must match the data type of the specified property. You can call TDMS_GetFilePropertyType to get the data type of a file property.

If the data type of the specified property is string, you must pass an array of characters. This array must be large enough to hold the entire string as reported by TDMS_GetFileStringPropertyLength plus the terminating NUL byte. Sample code is shown below:

char value[256];

TDMS_GetFileProperty (file, "MyStringProperty", value, sizeof(value));


If the data type of the specified property is TDMS_Timestamp, you must pass a pointer to a value of type CVIAbsoluteTime. Refer to the Absolute Time functions in the Utility Library for more information about this type.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. Unless otherwise stated, zero represents successful execution and a negative number represents the error code.

Error codes are defined in cvi\include\cvitdms.h.

Additional Information

Library: TDM Streaming Library

Include file: cvitdms.h

LabWindows/CVI compatibility: LabWindows/CVI 8.1 and later

© 2016 National Instruments. All rights reserved.

Example

Refer to TDM Streaming\tdmsReader.cws for an example of using the TDMS_GetFileProperty function.