CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    Join Date
    May 2009
    Posts
    140

    Smile how to read memory address and get its value

    hi, i want to read memory at adress 02804C20 and get its value, this should be simple but i'm a little new at this ^^

    it should be something like
    char txt[512];
    txt = value.from.memory.at(02804C20);

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: how to read memory address and get its value

    Code:
    memcpy (txt, (char*)(02804C20), sizeof(txt));
    Why do you want to read something from a static memory address ?

  3. #3
    Join Date
    May 2009
    Posts
    140

    Re: how to read memory address and get its value

    i thougt i'd need a pointer at first too, but address was fully static

  4. #4
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: how to read memory address and get its value

    i thougt i'd need a pointer at first too, but address was fully static
    Memory addresses change every time you run your program... that's why I asked.

  5. #5
    Join Date
    May 2009
    Posts
    140

    Re: how to read memory address and get its value

    Quote Originally Posted by Skizmo View Post
    Code:
    memcpy (txt, (char*)(02804C20), sizeof(txt));
    Why do you want to read something from a static memory address ?
    that gives me errors =\
    wrong syffix for number
    bad number 8 for base 8
    sint error: no ) before C20
    sint error: no )

  6. #6
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: how to read memory address and get its value

    oops.. my bad...
    Code:
    memcpy (txt, (char*)(0x02804C20), sizeof(txt));

  7. #7
    Join Date
    May 2009
    Posts
    140

    Re: how to read memory address and get its value

    thx) works

    btw sizeof(text) returns real size of text or its maxsize? or maxsize was maxsizeof(txt) ?
    Last edited by Owyn; May 13th, 2009 at 07:00 AM.

  8. #8
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: how to read memory address and get its value

    Code:
    char txt[512];
    sizeof(txt) is 512. It returns 512 * sizeof(char).

  9. #9
    Join Date
    May 2009
    Posts
    140

    Re: how to read memory address and get its value

    plus, how do i get value from 4 bytes address into an int ?

    ps-how do i get the real size? like if char = '12345" so it'd be 5 or 6

  10. #10
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: how to read memory address and get its value

    like if char = '12345" so it'd be 5 or 6
    strlen

  11. #11
    Join Date
    May 2009
    Posts
    140

    Re: how to read memory address and get its value

    strlen
    thx, but what about int value? i have an adress 4 bytes which has a number, i need this number to count things

  12. #12
    Join Date
    Apr 1999
    Posts
    27,449

    Re: how to read memory address and get its value

    Quote Originally Posted by Owyn View Post
    i thougt i'd need a pointer at first too, but address was fully static
    You didn't answer the question.

    Why do you want to read the memory at a certain address? What application are you writing that requires this?

    Regards,

    Paul McKenzie

  13. #13
    Join Date
    May 2009
    Posts
    140

    Re: how to read memory address and get its value

    Quote Originally Posted by Paul McKenzie View Post
    You didn't answer the question.

    Why do you want to read the memory at a certain address? What application are you writing that requires this?

    Regards,

    Paul McKenzie
    an opengl game, i looked for a pointer but it was the address itself or something like that

  14. #14
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: how to read memory address and get its value

    Unless you're working with very specialized hardware, there's almost no reason ever to hard-code a particular address.

  15. #15
    Join Date
    Feb 2005
    Posts
    2,160

    Re: how to read memory address and get its value

    If you have a pointer, you can just dereference it (assuming you know what kind of data it is pointing at). I think you're missing some simple C++ concept here (or you're trying to cheat at the game).

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured