Pointer to memory address

Discussion in 'C++' started by techinspiration, May 30, 2010.

  1. techinspiration

    techinspiration New Member

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

    inspiration New Member

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

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    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 far pointer 0000:041c */
     
  4. techinspiration

    techinspiration New Member

    Joined:
    Feb 14, 2010
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    0
    As soon as I can I create a variable with no prob on the address space access. Can someone tell me why it does not go without a variable?

    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. creative

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    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:
    http://ipankaj.net
    Well, I would say, because you may not be the storage area
    belongs.
     
  7. techinspiration

    techinspiration New Member

    Joined:
    Feb 14, 2010
    Messages:
    54
    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. 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:
    http://ipankaj.net
    Yes, but you can not read or write it because you like the storage
    area is not heard.
     
  9. creative

    creative New Member

    Joined:
    Feb 15, 2010
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    0
    I have such a result that works under Linux, you have other systems under test.

    mem_addr int = 0x0041;
    ptr_of_int 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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice