LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

TDMS_ReserveFileSize

TDMS_ReserveFileSize

int TDMS_ReserveFileSize (TDMSFileHandle file, unsigned __int64 numberOfReservedSamples, TDMSDataType dataType, TDMSReserveFileSizeMode reserveFileSizeMode);

Purpose

Pre-allocates disk space for writing and prevents fragmentation on a file system level. This function requires your application to run with administrator privileges. You can accomplish this by running your application as administrator or by embedding a manifest in the application that requests elevation. While debugging your application, you can launch LabWindows/CVI with administrator privileges and your application will also run with administrator privileges while being debugged.

When a .tdms file is in use by this function, no other processes can access this file.

(Linux) This function is not supported.

(Real-Time Module) This function is not supported.

Parameters

Input
Name Type Description
file TDMSFileHandle The file handle. You obtain this handle from TDMS_AdvancedOpenFile or TDMS_AdvancedCreateFile.
numberOfReservedSamples unsigned __int64 The size to reserve in samples. The size of a sample is determined by the dataType parameter.

You can calculate the actual size, in bytes, that this function reserves by multiplying the value of numberOfReservedSamples by the size of dataType in bytes. For example, if the value of numberOfReservedSamples is 512 and dataType is TDMS_UInt16, then you can calculate the actual size that this function reserves as follows: 512x(2) = 1024 bytes.
dataType TDMSDataType The data type of the samples referred to by numberOfReservedSamples.
reserveFileSizeMode TDMSReserveFileSizeMode Specifies whether to extend the current file size by the requested size or to set the total size of the file to the requested size.

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_ReserveFileSize function:

  • 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 Write\TDMS Advanced Sync Write.cws

    Open example
Was this information helpful?

Help us improve your future ni.com experience.

Did you find the documentation you were looking for?

Submit