⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 linux terminal thread semophores
💻 C
字号:
#include <sys/types.h>#include <sys/ipc.h>#include <sys/msg.h>#include <stdio.h>#include <string.h>     struct msgbuf {                long mtype;       /* message type, must be > 0 */                char mtext[1];    /* message data */            };int main(){  struct msgbuf m;  int ID=1,msgc;  key_t key;   if((key = ftok("./",'a'))==-1)	perror("key");  if((msgc=msgget(key,IPC_CREAT|0640))==-1)	perror("msgget");   m.mtype=1;   strcpy(m.mtext,"bau bau");  if(msgsnd(msgc, &m, sizeof(m), 0)==-1)	perror("snd");  printf("Merje!");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -