#include<stdio.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<string.h>
int main(){
int shmid
=shmget
(key, 1024, 0666 | IPC_CREAT
);char*str=(char*) shmat(shmid, NULL,0);
strcpy(str, "Hello fom the server!");
printf("Server: Data written to shared memory. \n"); shmdt(str);
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3lzL2lwYy5oPgojaW5jbHVkZTxzeXMvc2htLmg+CiNpbmNsdWRlPHN0cmluZy5oPgppbnQgbWFpbigpewprZXlfdCBrZXk9ZnRvaygic2htZmlsZSIsNjUpOwppbnQgc2htaWQ9c2htZ2V0KGtleSwgMTAyNCwgMDY2NiB8IElQQ19DUkVBVCk7CmNoYXIqc3RyPShjaGFyKikgc2htYXQoc2htaWQsIE5VTEwsMCk7CnN0cmNweShzdHIsICJIZWxsbyBmb20gdGhlIHNlcnZlciEiKTsKcHJpbnRmKCJTZXJ2ZXI6IERhdGEgd3JpdHRlbiB0byBzaGFyZWQgbWVtb3J5LiBcbiIpOwpzaG1kdChzdHIpOwpyZXR1cm4gMDsKfQ==
#include<stdio.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<string.h>
int main(){
key_t key=ftok("shmfile",65);
int shmid=shmget(key, 1024, 0666 | IPC_CREAT);
char*str=(char*) shmat(shmid, NULL,0);
strcpy(str, "Hello fom the server!");
printf("Server: Data written to shared memory. \n");
shmdt(str);
return 0;
}