Re: How to read/write an 'address' from a memory location......



aeroboro221@xxxxxxxxxxxxxx wrote:
I am trying to read an address from a memory location and then write
into that memory location.

Which "that" --- the one you read the address from, or the one the address specifies?

unsigned long * mem_pointer = 0x93700020;
unsigned long mem_value = *mem_pointer;

The question is - How do i use the value at <i> mem_value </i> as an
address?

An address kept in a variable is called a pointer, in C programs. So mem_value should be of a pointer type, rather than an integer. Consequentially, mem_pointer should be a pointer-to-pointer-to-something type, e.g.

some_type **mem_pointer = ...;
some_type *mem_value = *mem_pointer;
some_type the_actual_thing = *mem_value;

Basically, I want to do something like.
*(unsigned char *)mem_value = 10.

And what's keeping you from doing exactly that?

But this all hides a probably more important question: why do you think you should be doing this?
.



Relevant Pages

  • RE: mysql installation problems
    ... Warning: duplicate function definition 'do' detected in mysql.xs, ... from integer without a cast ... dbdimp.c:2583: error: cannot convert to a pointer type ...
    (perl.dbi.users)
  • AW: mysql installation problems
    ... Warning: duplicate function definition 'do' detected in mysql.xs, ... from integer without a cast ... dbdimp.c:2583: error: cannot convert to a pointer type ...
    (perl.dbi.users)
  • AW: mysql installation problems
    ... Warning: duplicate function definition 'rows' detected in mysql.xs, ... from integer without a cast ... dbdimp.c:2583: error: cannot convert to a pointer type ...
    (perl.dbi.users)
  • DBD:mysql installation problems
    ... from integer without a cast ... from pointer without a cast ... dbdimp.c:1987: warning: initialization makes pointer from integer without a ... dbdimp.c:2583: error: cannot convert to a pointer type ...
    (perl.dbi.users)
  • RE: mysql installation problems
    ... from integer without a cast ... dbdimp.c:1987: warning: initialization makes pointer from integer without ... dbdimp.c:2583: error: cannot convert to a pointer type ...
    (perl.dbi.users)