TDMS_AdvancedCloseFile
- Updated2023-02-21
- 3 minute(s) read
int TDMS_AdvancedCloseFile (TDMSFileHandle file, int truncate, double timeoutInSec);
Purpose
Closes a file handle and releases extra disk space reserved by TDMS_ReserveFileSize. This function also closes all open channel group and channel handles for the specified file.
(Linux) This function is not supported.
Parameters
| Input | ||
| Name | Type | Description |
| file | TDMSFileHandle | The handle of the file to close. You obtain this handle from the TDMS_AdvancedCreateFile or TDMS_AdvancedOpenFile function. |
| truncate | int | Specifies whether to truncate the .tdms file when closing this file. If the value is nonzero, this function truncates the file at the current writing position. If the value is zero, this function does not truncate the file and only releases extra disk space reserved by TDMS_ReserveFileSize. |
| timeoutInSec | double | Specifies the maximum time, in seconds, that this function waits for pending asynchronous reads or writes to complete before closing the .tdms file. This function might take longer than the specified timeout to complete as the timeout does not apply to the time required to close the file or call callback functions for pending asynchronous operations. This value has an effect only if you called TDMS_AdvancedCreateFile or TDMS_AdvancedOpenFile with the option to enable asynchronous operations. If any asynchronous operations are still pending after the timeout has elapsed then those pending operations will be canceled. If you specified a callback for those operations, the callback will be called with the error parameter set to TDMS_OperationCancelled. |
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 2013 and later
© 2016 National Instruments. All rights reserved.
Examples
Refer to the following examples that use the TDMS_AdvancedCloseFile function:
- TDM Streaming\Advanced Read and Write\TDMS Advanced Async Read\TDMS Advanced Async Read.cws
Open example - TDM Streaming\Advanced Read and Write\TDMS Advanced Async Read Throughput Test\TDMS Advanced Async Read Throughput Test.cws
Open example - TDM Streaming\Advanced Read and Write\TDMS Advanced Async Write\TDMS Advanced Async Write.cws
Open example - TDM Streaming\Advanced Read and Write\TDMS Advanced Async Write Throughput Test\TDMS Advanced Async Write Throughput Test.cws
Open example - TDM Streaming\Advanced Read and Write\TDMS Advanced Sync Read\TDMS Advanced Sync Read.cws
Open example - TDM Streaming\Advanced Read and Write\TDMS Advanced Sync Write\TDMS Advanced Sync Write.cws
Open example