Hi there,
Im new to this site, and I just have a question of something that I have been trying lately in the C language.
I need to put a whole array in a shared memory file (using POSIX).
I have no problems putting simple int* in shared memory. I do it this way:
int main(int argc, char* argv[]){
...
int *ptr;
...
int fd=shm_open("/shm12",O_RDWR|O_CREAT,S_IRUSR|S_IWUSR);
...
ftruncate(fd,sizeof(int));
...
ptr=mmap(0,11*sizeof(int),PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
...
}
Thats basically it, without error checking. What do I need to do to simillarly put an array, lets call it buffer[10], in shared memory?
Id apprecciate if anyone could help me.