#include #include #include #include #include #include int main() { key_t key = ftok("mem", 0); printf("key=%zx\n", (size_t)key); int sid = shmget(key, 128*1024*1024, IPC_CREAT | 0600); if (sid < 0) { perror("shmget"); return 1; } void *addr = shmat(sid, NULL, 0); if (addr == NULL) { perror("shmat"); return 1; } strcpy((char *)addr, "Hello!"); shmdt(addr); }