#include #include #include #include #include #include struct test{ int x; char text1[30]; char text2[100]; char text3[20]; }; int main () { int shmID; struct test *s; shmID = shmget(1000,sizeof(struct test)*5, 0666 | IPC_CREAT); printf("shmID = %d\n",shmID); if(shmID < 0){ printf("error\n"); } s= (struct test *)shmat(shmID, NULL, 0); printf("value: %d\n",s[1].x); shmdt(s); return 0; }