I want to create a shared memory between two process. I used fork(). A child tries to change this shared memory and mother creates another child so new child tries to change same memory so on. here is my code in C programing. (ubuntu)
mylist ch=NUL;
f=fork();
if(!f){
pba=shmget(KEYSHM,sizeof(char),0); /*created shared memory*/
ch=(mylist *) shmat(pba,0,0);
ch->name=ugur;
ch->surname=cedric;
...do something...
}
else{
if(ch)
printf("this is top of mylist %s"ch->name);
.......do something
}
It never writes ch->name. why? I created a shared memory. Why parent process cannot read?