First of all, thank you for your response!
This link takes me to "GetDiskFreeSpace function" on the MSDN site. Did I miss a link somewhere for the FileAPI.h header file? Please advise. Thank you again!
Oops. Sorry. I thought that was the function you were using, my mistake.
FileAPI.h is a old header. It's nowhere to be found in a modern Windows SDK.
As the MSDN entries state, you should include Windows.h
and let it include the other core headers.
FileAPI.h (include Windows.h);
WinBase.h on Windows Server 2008 R2, Windows 7, Windows Server 2008,
Windows Vista, Windows Server 2003, and Windows XP (include Windows.h)
So you should strip down this
PS The MSDN entry does also mention that GetFileSize (and GetFileSizeEx) is now defined in WinBase.h. But WinBase.h is included by Windows.h...
Last edited on
Ok thank you for your help. Will strip down the headers as you indicate.
Ok as you clearly see that I include the Windows.h header. Can you help me with the following errors (note that my code is pasted above in my 2nd entry)?
error C3861: '_get_osfhandle': identifier not found
error C2660: 'GetFileSize' : function does not take 1 arguments
error C2065: 'hFile' : undeclared identifier
I was assuming that they were related to FileAPI.h (a simple fix), but now that you have shed light on the fact that they should be in Windows.h - clearly that isn't the issue.
Would you have a look at the errors and the code and let me know your thoughts on how to fix these?
Again, thank you for your help!
Chech out their entries in MSDN
Applies to: desktop apps only
Retrieves the size of the specified file, in bytes.
It is recommended that you use GetFileSizeEx.
DWORD WINAPI GetFileSize(
_In_ HANDLE hFile,
_Out_opt_ LPDWORD lpFileSizeHigh
(Note that when they say "applies to desktop apps only", Microsoft means normal, old-school Win32 or Win64 programs as opposed to the new Metro style apps)
Last edited on