Help for a program knowing the free memory space in our OS

Good afternoon,

I'm in trouble. I've been sent an assignment for getting a C++ program to know my our OS's free memory. In our case, we own windows 7. Could anybody help me programming this program? Please!

Thanks!

Peste
http://bit.ly/Z7l1IX
First result: http://stackoverflow.com/questions/2513505/how-to-get-available-memory-c-g
Answer wrote:
On Windows, there is GlobalMemoryStatusEx:
1
2
3
4
5
6
7
8
9
#include <windows.h>

size_t getTotalSystemMemory()
{
    MEMORYSTATUSEX status;
    status.dwLength = sizeof(status);
    GlobalMemoryStatusEx(&status);
    return status.ullTotalPhys;
}
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx
You can get all kinds of various info about the memory.
Last edited on
Topic archived. No new replies allowed.