DWORD GetFileSize(hFile, lpdwFileSizeHigh) | |||||
HANDLE hFile; | /* identifies the file | */ | |||
LPDWORD lpdwFileSizeHigh; | /* high 32 bits of file size | */ |
The GetFileSize function retrieves the size (in bytes) of the specified file.
hFile
Specifies an open handle to the file whose size is being returned. The handle must have been created with either GENERIC_READ or GENERIC_WRITE access to the file.
lpdwFileSizeHigh
Points to the variable where the high-order 32 bits of the file size will be returned. This parameter can be NULL if the application does not require the high-order 32 bits.
If the function is successful, the return value is the low-order 32 bits of the file size.
If an error occurs, the return value is -1 (0xFFFFFFFF). Use the GetLastError function to obtain extended error information.
It is possible for the return value to be 0xFFFFFFFF when an error has not occurred, if the file size causes the low-order 32 bits to be 0xFFFFFFFF. In this case, the GetLastError function returns NO_ERROR.
Using this function with a handle to a non-seeking device (such as a pipe or a communications device) has no meaning. Use the GetFileType function to determine the file type for hFile.