How to fix that bug with ReadProcessMemory?

  c++, memory, pointers, readprocessmemory

i have a problem with my c++ code. If i want to read the value(integer) from a pointer and the value is bigger than 9 I get weird results. For example if the value is 10 my output is that the value is a. If the value is 11 is my output is b and so one. Here my code:

int value;
ReadProcessMemory(processHandle, (LPVOID)(diamondAddress), &value, 4, 0);
std::cout << "Value: " << value;

Output: Value: a

Source: Windows Questions C++

LEAVE A COMMENT