Click to See Complete Forum and Search --> : How to get blocksize from harddisk?


Mark Veldt
May 26th, 1999, 04:47 AM
When I copy small files to harddisk, then there is more space needed than the total filesize.

How can i detect what real harddisk space is needed?

Mark

Jason Teagle
May 26th, 1999, 10:24 AM
GetDiskFreeSpace() gets information about the disk sizes. I think a file takes up a whole number of clusters, so you should find that bytes per sector * sectors per cluster gives you the minimum block size. Your files will take a multile of that size, I believe.

Mark Veldt
May 27th, 1999, 03:26 AM
I know that GetDiskFreeSpace() is not what i need, thats why this question.

Question: how to get sector-, cluster- and blocksize from disk

Mark

Jason Teagle
May 27th, 1999, 03:36 AM
Why do you say GetDiskFreeSpace() is not what you need? Have you looked up the function in the help? It gives sectors per cluster (= cluster size when multiplied by the next item), bytes per sector (= sector size), free clusters available and total number of clusters. Exactly what you are asking for. Blocksize is, as far as I know, one cluster.

Mark Veldt
May 27th, 1999, 06:37 AM
Sorry,
i looked at the wrong function (GetDiskFreeSpaceEx()), my apologies for the misunderstanding.

Mark

Jason Teagle
May 27th, 1999, 06:42 AM
Ah, yes. I forgot. We use VC++ V4.0 here, so that function isn't available. What does that return, out of interest?

Mark Veldt
May 27th, 1999, 09:04 AM
BOOL GetDiskFreeSpaceEx(
LPCTSTR lpDirectoryName, // pointer to the directory name
PULARGE_INTEGER lpFreeBytesAvailableToCaller, // receives the number of bytes on
// disk available to the caller
PULARGE_INTEGER lpTotalNumberOfBytes, // receives the number of bytes on disk
PULARGE_INTEGER lpTotalNumberOfFreeBytes // receives the free bytes on disk
);