GetFileSize

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

Purpose

Gets the size of a file, in bytes.

Note   Windows SDK also contains a GetFileSize function. If you include windows.h and do not include utility.h, you will receive compile errors if you call the GetFileSize function.

Example

/* 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 string 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 long Size of the file in bytes.

Return Value

Name Type Description
result integer 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.