as in subject, how to get disk size, not free space (GetDiskFreeSpace) but the size of c: drive...
thanks for replies
as in subject, how to get disk size, not free space (GetDiskFreeSpace) but the size of c: drive...
thanks for replies
Look closer at that function, and your answer will become apparentOriginally posted by Turek
as in subject, how to get disk size, not free space (GetDiskFreeSpace) but the size of c: drive...
thanks for replies
BytesPerSector * SectorsPerCluster * TotalNumberOfClustersCode:BOOL GetDiskFreeSpace( LPCTSTR lpRootPathName, // root path LPDWORD lpSectorsPerCluster, // sectors per cluster LPDWORD lpBytesPerSector, // bytes per sector LPDWORD lpNumberOfFreeClusters, // free clusters LPDWORD lpTotalNumberOfClusters // total clusters );
That will give disk size in bytes
god damn true!! thanks man!!!
but i get an error, look at my code:
error is:PHP Code:
#include <iostream>
#include <string>
using namespace std;
void main()
{
DWORD dwSectorsPerCluster,dwBytesPerSector,dwNumberOfFreeClusters,dwTotalNumberOfClusters;
if (GetDiskFreeSpace(NULL,&dwSectorsPerCluster,&dwBytesPerSector,&dwNumberOfFreeClusters,&dwTotalNumberOfClusters)) {
double space = &dwSectorsPerCluster * &dwBytesPerSector * &dwTotalNumberOfClusters;
cout << space / 1073741824 << endl;
system("PAUSE");
} else {
cout << "not hd" << endl;
system("PAUSE");
}
}
file.cpp(38) : fatal error C1010: unexpected end of file while looking for precompiled header directive
the funniest is that file has only 37 lines
i am having Visual C++ 60...
any ideas ??
It is trying to "precompile" the windows headers, but you are not including them. I think you can include "windows.h" first in the file to get rid of it, or you can also change the settings for the project so that it does not try to use a precompiled header. Goto project->settings. Select the c/c++ tab. Pulldown the category combo box to Precompiled headers. Select the radio button "Not using precompiled headers"
thanks a lot!