p11.1.c

来自「linux编程源代码,其中是由大量的实例」· C语言 代码 · 共 30 行

C
30
字号
#include <stdio.h>#include <sys/types.h>#include <sys/ipc.h>int main(void){	key_t key;	int proj_id;	char* pathname="./p11.1.c";	proj_id=1;	key=ftok(pathname,proj_id);	if(key==-1){		perror("cannot generate the IPC key");		return 1;	}	printf("proj_id= %d pathname=%s IPC key=%d\n",proj_id,pathname,key);	proj_id=2;	key=ftok(pathname,proj_id);        if(key==-1){                perror("cannot generate the IPC key");                return 1;        }        printf("proj_id= %d pathname=%s IPC key=%d\n",proj_id,pathname,key);}

⌨️ 快捷键说明

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