CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: harddiskspace

  1. #1
    Guest

    harddiskspace

    hi everybody !
    how can i find out the free space of a harddisk ?
    thanks




  2. #2
    Join Date
    May 1999
    Posts
    17

    Re: harddiskspace

    Hi,
    Try this:

    struct _diskfree_t diskfree;
    int nDrive = _getdrive(); // use current drive
    if (_getdiskfree(nDrive, &diskfree) == 0)
    {
    strFreeDiskSpace.Format( "%lu KB Free on %c:",
    (DWORD)diskfree.avail_clusters *
    (DWORD)diskfree.sectors_per_cluster *
    (DWORD)diskfree.bytes_per_sector /(DWORD)1024L,
    nDrive-1 + _T('A'));
    }
    else strFreeDiskSpace = Unavailable;

    MessageBox( strFreeDiskSpace );

    Cheer: Mileta


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