如何获取磁盘中文件的大小?如Windows资源管理器中所示?例如,文件名具有:
size: 172 bytes (172 bytes)
size on disk: 0 bytes
但是我的应用程序显示:
GetDiskFreeSpace(L"C:\\" §orsPerCluster, &lpBytesPerSector,
&numberOfFreeClusters, &totalNumberOfClusters));
int TotalSize = lpBytesPerSector * ((fileLength + lpBytesPerSector - 1) / lpBytesPerSector);
printf("fileLength = %d\n", fileLength);
printf("TotalSize = %d\n", TotalSize);
其输出:
fileLength = 172
TotalSize = 512
我缺少什么来正确计算文件名在磁盘中的大小?