• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About pandabear114

  • Rank
  1. i have a pointer i want to change the address of after runtime problem is the user has to enter the address manually say the pointer is: int *pointer = (int*)0xAAAAAAAA; in the code, i can change the value of the pointer like: pointer = (int*)0xBBBBBBBB; but i want to enter the address after the program is running (won't know until then) i have a function like void editPointer(int **pointer) { char offset[8]; // code to fill 8 values of memory address in char array // such as offset = { 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB } *pointer = ? (here's the problem, i could do like *pointer = (int*) 0xBBBBBBBB, but "BBBBBBBB is stored in the char array and changes with input) } i couldn't get anything like *pointer = (int*)offset; to work (for obvious reasons) so i ended up trying to make the array into an int i don't know if it is possible to just convert the array's text into a hex integer like 0xBBBBBBBB (or at least don'e know how) so i ended up doing: int int_val = 0; int i = 0; while (i < 8) { int_val = int_val << 4; int_val += offset[i]; i++; } which i believe gets the correct integer value from the hex from that i tried like *pointer = (int*)int_val; but had no sucess does anyone see the problem or have any suggestions? i can't do a scanf or cin, the only way i can get input is by monitoring keystrokes one at a time thanks in advance
  • Advertisement