?? shmwrite.c~
字號(hào):
/* Includes */#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>typedef struct{int tc_number;char ap_name[5];char mymessage[20];} COMM_TABLE;main(){/* local variables */int ret= 0;key_t key;int i;int shm_id;int found = 0;COMM_TABLE *comm_reg;key = ftok(".",'w');/* create a share memory if not exist */if ((shm_id = shmget(key ,sizeof(COMM_TABLE),IPC_CREAT|IPC_EXCL|0666)) == -1){/* share memory has been created */if ((shm_id = shmget(key , sizeof(COMM_TABLE),0)) == -1){printf("error = %d\n", errno);return (ret);}}comm_reg = (COMM_TABLE *) shmat(shm_id, (char *) 0, (int)NULL);comm_reg->tc_number= 10000000;}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -