Reputation: 650
I want to get Video memory from GPU. I use WMI - Win32_VideoController class, property AdapterRAM. It returns value in bytes, so I convert it to MB:
int gpuRAM_MB = (gpuAdapterRAM.uintVal) / (1024) / (1024);
When I tried convert value to GB it returns as 3 GB (In other softwares such as AIDA64 it returns 4 GB):
int gpuRAM_GB = (gpuAdapterRAM.uintVal) / (1024) / (1024) / (1024);
AIDA64:
The issue is how to convert it to GB? Thanks in advance.
Upvotes: 0
Views: 146
Reputation: 1052
Use floating point division and ceil()
function.
int gpuRAM_MB = ceil((gpuAdapterRAM.uintVal) / (1024.0) / (1024.0));
Upvotes: 1