BOOL CHDTLog::IsDiskNotEnough(void)
{
ULARGE_INTEGER nFreeBytesAvailable ;
ULARGE_INTEGER nTotalNumberOfBytes ;
ULARGE_INTEGER nTotalNumberOfFreeBytes ;
// 获取日志文件的根目录
m_strLogFileRootDirectory = m_filename.substr (0, 2) ;
// 获取用户现在可用的剩余空间容量
if (GetDiskFreeSpaceEx(&nFreeBytesAvailable, &nTotalNumberOfBytes, &nTotalNumberOfFreeBytes))
{
ULONGLONG FreeAvailable = nFreeBytesAvailable.QuadPart ;
if (FreeAvailable <= m_RemainMemorry)
{
return TRUE ;
}
else
{
return FALSE ;
}
}
else
{
throw runtime_error ("获取磁盘剩余空间失败") ;
}
}
更多详细情况,请详见:
1.http://www.cnblogs.com/Charlotte/archive/2007/03/01/660574.html