address of address -how to cast to get 
Author Message
 address of address -how to cast to get

Hi folks,
given
  char * pcities;
  char * cities[5] = {"San Diego", "Miami", "New York",
                      "Oklahoma City", "St. Louis"};
  pcities = *(cities+0); // assuming 0066fd5c
0066FD6C  4C 94 42 00 60   81  42   00  30   81  42   00  48 81 42 00
0066FD7C  3C 81 42 00 CC CC CC CC CC CC CC CC 05 00 00 00

0042944c = "San Diego"
00428160 = "Miami"
00 428130 = "New York"
00428148 = "Oklahoma City"
0042813c = "St Louis"

00428130  4E 65  77 20 59 6F 72 6B 00 00  00 00 53 74 2E 20  New York....St.
00428140  4C 6F 75 69 73 00  00 00 4F 6B 6C 61 68 6F 6D 61  Louis...Oklahoma
00428150  20  43 69 74 79 00  00 00 00 00  00 00 00  00 00 00
City...........
00428160  4D 69 61 6D 69 00  00 00 00 00  00 00 4D 69 63 72  Miami....

How? can i cast ?? to enable me to use a pointer (to use pointer arithmetic)
to access the pointers in the
memory at 0066fd6c ie. the addresses of the strings above = 0042944c,
00428160, 00428130, 00428148
and 0042813c ?????? I know i don't HAVE to be able to access these pointers
to get at the strings, i just want to
know how (& if) it can be done?! Please. Do i have to ?cast? in order to do
this
Any help well appreciated, cheers

Ian Turnbull
 (0961 931 941)



Sun, 17 Mar 2002 03:00:00 GMT  
 address of address -how to cast to get
Yikes!


Quote:
> Hi folks,
> given
>   char * pcities;
>   char * cities[5] = {"San Diego", "Miami", "New York",
>                       "Oklahoma City", "St. Louis"};
>   pcities = *(cities+0); // assuming 0066fd5c
> How? can i cast ?? to enable me to use a pointer (to
> use pointer arithmetic) to access the pointers in the
> memory at 0066fd6c

First off, forget about addresses... they are irrelevant.
pcities is unrelated to cities... it just happens to have
they same value as cities[0].  Therefore, you can't poke
around cities using pcities.

But, if you do this:

char** pcities = cities;

p+0 == cities[0]
p+1 == cities[1]
etc.

I think that's what you were asking.  Why you're doing
this is something I could ask... but I won't.

marco



Sun, 17 Mar 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to get MAC address from IP Address

2. convert mac address to ip address

3. How can i get MAC Address by IP address in SCO UNIX C

4. PMode Address -> Segment:Offset Address

5. address of structure == address of first member? (long)

6. Incomplete import address table causes jump to invalid address

7. Determinig a machine's Physical Address (MAC Address)

8. Obtaining a PCI address vs a virtual address?

9. IP address and Mac Address help!!!

10. ftp server address to http address

11. MAC ADDRESS ie Ethernet Card Address

12. 32 Bit Flat Address to 16 Bit Segmented Address

 

 
Powered by phpBB® Forum Software