Thread: hex numbers
View Single Post
Old 10-01-2002, 08:53 AM   #2
welcor
Member
 
Join Date: Apr 2002
Location: Aarhus, Denmark, Europe
Posts: 59
welcor is on a distinguished road
Send a message via ICQ to welcor
void *ptr;
struct obj_data *obj;

sscanf(txt, "%p", &ptr);
obj = (struct obj_data *)ptr;

Beware, though. This is a sure way to crash your game. There is no check for validity involved. If you happen to
put in a wrong number, the 'obj' pointer may cause all sorts of troubles.
You should consider other ways of getting to the object. Whether you wish to have some sort of internal numbering or recognize it by name is your choice, but typing in memory values is asking for trouble.
welcor is offline   Reply With Quote