|
From: Jason H. <jas...@bt...> - 2001-12-05 18:44:14
|
I wouldn't try and count the amount of memory available as you would get a missleading figure. Memory addresses don't directly map to the real addresses used by the system and Windows makes up for lack of physical RAM by using Virtual Memory (a swap file). Also trying to access memory not assigned to you will cause access violations to occur. After a quick look in the Win32API Reference I found the function GlobalMemoryStatus(); which can be used to obtain various memory usage details, including the amount of physical RAM in the system. A quick summary: #include <windows.h> #include <iostream> ... MEMORYSTATUS meminfo; meminfo.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&meminfo); cout << "Amount of Physical RAM = " << meminfo.dwTotalPhys << endl; ... This is an untested segment, but should work OK. Check out the Win32API Reference for more information. Jason. ----- Original Message ----- From: "Ian Weston" <lak...@ho...> To: <dev...@li...> Sent: Wednesday, December 05, 2001 5:11 PM Subject: [Dev-C++] Memory > Hello everybody. i was wondering, does anyone know the code that will count > the amount of memory in you PC. > > thanks in advance to anyone that can help. > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |