Finding Hard Disk Memory Left On the Computer Through C/VC++

Discussion in 'C Programming' started by Vikas, Jun 26, 2003.

  1. Vikas

    Vikas Guest

    Hi all,

    I am developing an application which should stop once the memory
    available on the Hard Disk goes below a threshold value.

    Is there a function in C (or) VC++ to determine the current memory
    left on the hard disk ??? If there is no direct function, what
    methodology can be adopted?

    Thanks,
    Vikas
     
    Vikas, Jun 26, 2003
    #1
    1. Advertisements

  2. No, there is no direct function in C or C++. There might be one in VC++,
    whatever that is. But that would be an implementation-dependent function
    and thus off-topic for both comp.lang.c or comp.lang.c++.

    <off-topic>Hard disks don't have "memory". The data there is stored in
    a form which is not directly accessible by the processor. It is called
    "space".</off-topic>
     
    Joona I Palaste, Jun 26, 2003
    #2
    1. Advertisements

  3. Memory as in availale HD space or as in swap space?
    First: This isn't on topic for clc. I would guess that one of the groups
    in comp.os.ms-windows.programmer.* is the right place.

    There is probably a windows system call for this. Search the
    documentation.

    hth
    NPV
     
    Nils Petter Vaskinn, Jun 26, 2003
    #3
  4. I'd like to point out that "memory" and "disk storage" are not
    strictly the same thing. Muddling them up is not a good idea generally
    speaking.
    Well, my hard disk has 8Mb of memory no matter how full it is - thats
    the cache size. :)

    Other than that no, there's no C function to determine the free space
    on a disk. This is because C is designed to function on systems
    without disks, such as my Palmpilot, a fridge, or even a diskless
    workstation or terminal.
    Your OS probably has a GetFreeSpace() type function though. I suggest
    you browse your compiler's online help, probably via a search for
    "disk space".
     
    Mark McIntyre, Jun 26, 2003
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.