1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Pointer to memory address

Discussion in 'C++' started by meyup, Jun 8, 2010.

  1. meyup

    meyup New Member

    Joined:
    Feb 15, 2010
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    I have a small problem. Following a pointer to point to a particular segment: offset (for example 0041Ch)
    How can I now put a pointer to this address?
     
  2. techme

    techme New Member

    Joined:
    Feb 15, 2010
    Messages:
    86
    Likes Received:
    0
    Trophy Points:
    0
    But once the trial here is not whether the white Abder:
    Code:
    char* pointer; 
    Pointer = 0x0041;
     
  3. inspiration

    inspiration New Member

    Joined:
    Feb 15, 2010
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    0
    Segment and offset the smell of DOS programming, so all that follows is not a standard C + +, but Borland / Turbo C + + specific (DJGPP perhaps?)
    Code:
    # Include <dos.h> 
    char Far * my_far_pointer MK_FP = (0, 0x41C) / * make pointer Far 0000:041 c * /
     
  4. meyup

    meyup New Member

    Joined:
    Feb 15, 2010
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    0
    Once I add a variable I can no prob to access the address range. Can someone tell me why it does not go without a variable?

    Achso, I get the following error: expression must be a pointer or a zero constant.

    So far, no solution works ... : (

    who has other solutions ... just tell me
     
  5. inspiration

    inspiration New Member

    Joined:
    Feb 15, 2010
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    0
    the relevant code would still be useful ...
     
  6. pankaj.sea

    pankaj.sea New Member

    Joined:
    Apr 6, 2009
    Messages:
    461
    Likes Received:
    13
    Trophy Points:
    0
    Occupation:
    Web Developer
    Location:
    Kolkata
    Home Page:
    Well, I would say, because the memory area you may not
    belongs.
     
  7. meyup

    meyup New Member

    Joined:
    Feb 15, 2010
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    0
    Well, my current program does not have anything with the code you need to do now. I would just say exactly, I always read the values of exactly this location. With pure assembler can I do that ... But everything must go without asm. Can I ever passed from one hand to the pointer location?
     
  8. inspiration

    inspiration New Member

    Joined:
    Feb 15, 2010
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    0
    Yes, but you can neither read nor write it because you like the memory
    area is not heard.
     
  9. creative

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I have such a result that works on Linux, should be enumerated under other systems.
    Code:
    int mem_addr = 0x0041; 
    int * ptr_of_int; 
    long * ptr_of_long; 
    char * ptr_of_char; 
    
    ptr_of_int = (int *) mem_addr; 
    
    ptr_of_long = (long *) mem_addr; 
    
    ptr_of_char = (char *) mem_addr; 
     
  10. inspiration

    inspiration New Member

    Joined:
    Feb 15, 2010
    Messages:
    85
    Likes Received:
    0
    Trophy Points:
    0
    I would say that depends entirely on the OS
     

Share This Page