I need to read the memory address of a pointer from a file, since I implemented the function, an integer function that when reading the file it returns the stored address:
int Cargar(std::string nombre)
{
std::ifstream archivo;
archivo.open(nombre.c_str(),std::ios::in);
if(!archivo)
{
std::cout<<"No se pudo cargar el archivo."<<std::endl;
return 0;
}
int direccion;
archivo>>std::hex>>direccion;
return direccion;
}
int main()
{
int direccion = Cargar("Direcciones.txt");
std::cout<<direccion<<std::endl;
return 0;
}
When I print on the screen the result is always 0.
Note: in the file "Directions.txt", only the following line is found:
0x60fe1c