Untitled
unknown
plain_text
2 years ago
410 B
2
Indexable
#include<stdio.h> #include<stdlib.h> #include<sys/shm.h> #include<unistd.h> #include<string.h> void main() { char str[100]; int shmid=shmget((key_t)2366,1024,0666|IPC_CREAT); printf("Key of shared memory is %d\n",shmid); void *shm=shmat(shmid,NULL,0); printf("Process is attached at %p\n",shm); read(0,str,100); strcpy(shm,str); printf("Value shared is %s\n",(char*)shm); }
Editor is loading...