CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 1999
    Location
    Netherlands
    Posts
    57

    How to get blocksize from harddisk?

    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



  2. #2
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: How to get blocksize from harddisk?

    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.



    --
    Jason Teagle
    [email protected]

  3. #3
    Join Date
    May 1999
    Location
    Netherlands
    Posts
    57

    Re: How to get blocksize from harddisk?

    I know that GetDiskFreeSpace() is not what i need, thats why this question.

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

    Mark



  4. #4
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: How to get blocksize from harddisk?

    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.





    --
    Jason Teagle
    [email protected]

  5. #5
    Join Date
    May 1999
    Location
    Netherlands
    Posts
    57

    Re: How to get blocksize from harddisk?

    Sorry,
    i looked at the wrong function (GetDiskFreeSpaceEx()), my apologies for the misunderstanding.

    Mark



  6. #6
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: How to get blocksize from harddisk?

    Ah, yes. I forgot. We use VC++ V4.0 here, so that function isn't available. What does that return, out of interest?



    --
    Jason Teagle
    [email protected]

  7. #7
    Join Date
    May 1999
    Location
    Netherlands
    Posts
    57

    Re: How to get blocksize from harddisk?


    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
    );





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured