How to get the percentage of RAM memory is in use on windows PC in C Win32 API

1 Answer

0 votes
#include <windows.h>
#include <tchar.h>

int main(void) {

    MEMORYSTATUSEX statex;

    statex.dwLength = sizeof(statex);

    GlobalMemoryStatusEx(&statex);

    _tprintf(TEXT("%ld %% of memory in use\n"), statex.dwMemoryLoad);

    return 0;
}



/*
run:

48 % of memory in use

*/

 



answered Nov 12, 2021 by avibootz
edited Nov 12, 2021 by avibootz
...