Hi all,

I was trying to write into memory mapped area. significant lines are as :

size_t length = 2000;
int fd = open(filename , O_CREAT | O_RDWR, S_IRWXU );
void* addr = mmap(0, length , PROT_READ|PROT_WRITE , MAP_SHARED, fd, 0);
msync(addr , length , MS_SYNC) ;


Program till here was fine & running. but I want to write one interger into the addr using mmap.

int data = 10;
memcpy(addr ,(void*)&data , sizeof(int) );
OR
bcopy((void*)&data , addr , sizeof(int) );

program gives error as "bus error"

I was able to read a created file the same way. but I could not able to write into the mapped area.

thanx in advance