I am currently writing a program that requires me to find certain files in map based on their permissions and use "munmap" to unmap them. I have done this but munmap needs the address of the file, which I have stored in a char array in hexadecimal. Is there a way for me to create a pointer that points to the hexadecimal address I have stored in the char array? The only thing I can find is how to hard code it and I can't do this because each mapping is different.
idk if this helps but in C if you know the beginning address you can step through the rest
char *aPtr=yourArray;
//has the beginning address of your array now you can step through it with pointer notation
//and store the characters into something that can hold the address
Since the address is in hexa, it contains letters as well. aoti and scanf seem to only convert numbers. Trying to use "munmap(2)" - the parameters are 1) a pointer to the starting address and 2) the length to be unmapped. I have the starting address, but it is stored as a hexadecimal in a char array (i.e 0x7fa2c0e77000). I'm essentially trying to find a way to create a pointer that points to the hexadecimal address stored in the char array, not the actual array itself.
Code Example.
char Memory_Start[15]; // contains 12 bit hexadecimal address with '0x' at start and is null terminated.
Trying to create a pointer that points to the hexadecimal address INSIDE the char array.