I'm writing a code of writing a value to a specific memory address.
================================================== ===============
#include <stdio.h>
int main()
{
long air;
long *air_address;
printf("Air : %d, Air_address : %p\n", air, air_address);
(long *) air = air_address;
* (long *) air = 1211;
printf("Air : %d\n", * (long *) air);
/* Direct Memory Access to MEM[ 0x40009ca0 ] */
* (long *) 0x40009ca0 = 10;
printf("Direct MEM[0x40009ca0] = %d \n", * (long *) 0x40009ca0);
}
================================================== ===============
It was complied without any errors, but causes a run-time segmentation
error.
Is there anyone who tell the reason of why ?
and how to assign a value to a specific memory address ?
My test machine is a pentium processor and OS is a linux.
Thanks...
--
-------------------------------------------------------------
Jeong-Gun Lee
Concurrent System Research Lab., KJIST, South Korea.
Homepage : http://async.kjist.ac.kr/~eulia
E-mail : eulia(at)kjist.ac.kr, Phone : 062-970-2267, 016-382-6765