LabWindows/CVI

Content Type
Programming Language
Current manual

GetFileSize

GetFileSize

int GetFileSize (char fileName[], ssize_t *fileSize);

Purpose

Gets the size of a file, in bytes.

Caution  The Windows SDK also contains a function with the same name. Include windows.h before including utility.h to ensure that there are no compilation errors as a result of this naming conflict. Define the SDK_CONFLICT_PRIORITYSDK_CONFLICT_PRIORITY macro to force LabWindows/CVI to use the Windows SDK implementation of this function.

Example Code

/* Get the size of WAVEFORM.DAT. */
long size;
if (GetFileSize ("WAVEFORM.DAT",&size) == 0)

FmtOut ("The size of WAVEFORM.DAT is %i[b4]",size);

Parameters

Input
Name Type Description
fileName char [] The pathname of the file.

If you specify an empty string "", GetFileSize gets the file size found by the most recent call to GetFirstFile or GetNextFile.
Output
Name Type Description
fileSize ssize_t Size of the file in bytes.

Return Value

Name Type Description
result int The result of the call.

Code Description
0 Success.
-1 File not found or directory in path not found.
-3 General I/O error occurred.
-4 Insufficient memory to complete the operation.
-5 Invalid path; for example, c:filename.
-6 Access denied.

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Was this information helpful?