int segment_id = shmget(IPC_PRIVATE, sizeof(array),0660 | IPC_CREAT);
char** shared = shmat(segment_id,NULL,0);
This is a possible solution.
Frage
Ok, so I have an array of srings
char array[4][20];
//initialized
strcpy(array[0], "PERSON1");
strcpy(array[1], "PERSON2");
...
My question is how would I use shmget, and shmat to turn this array into shared memory? Any help appreciated!
Lösung
int segment_id = shmget(IPC_PRIVATE, sizeof(array),0660 | IPC_CREAT);
char** shared = shmat(segment_id,NULL,0);
This is a possible solution.