当前位置: 首页 > news >正文

用别人网站做app的危害手机如何建立网站

用别人网站做app的危害,手机如何建立网站,招聘app,小程序vr全景组件使用消息队列实现的2个终端之间的互相聊天 并使用信号控制消息队列的读取方式: 当键盘按ctrlc的时候,切换消息读取方式,一般情况为读取指定编号的消息,按ctrlc之后,指定的编号不读取,读取其他所有编号的消息…

使用消息队列实现的2个终端之间的互相聊天 并使用信号控制消息队列的读取方式: 当键盘按ctrl+c的时候,切换消息读取方式,一般情况为读取指定编号的消息,按ctrl+c之后,指定的编号不读取,读取其他所有编号的消息

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <semaphore.h>
#include <wait.h>
#include <signal.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <semaphore.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/un.h>
int brr=0;
struct msgbuf
{long mtype;char mtext[128];
};
void *run(void *arg)
{  int* mytype=(int*)arg;key_t key=ftok("./ipc",1);if(key==-1){perror("ftok");return NULL;}int id=msgget(key,IPC_CREAT|0666);if(id==-1){perror("msgget");return NULL;}struct msgbuf msg;int size=0;while(1)                                      {if(brr==0){memset(&msg,0,sizeof(msg));msgrcv(id,&msg,128,*mytype,IPC_NOWAIT);if(strlen(msg.mtext)!=0){putchar(10);printf("读取到的消息为:%s\n",msg.mtext);printf("请输入:");fflush(stdout);}else{;}}else if(brr==1){memset(&msg,0,sizeof(msg));msgrcv(id,&msg,128,*mytype,IPC_NOWAIT|020000);if(strlen(msg.mtext)!=0){putchar(10);printf("读取到的消息为:%s\n",msg.mtext);printf("请输入:");fflush(stdout);}else{;}}}
}
void handler(int signum)
{if(signum==SIGINT){brr=(brr+1)%2;printf("%d\n",brr);}}
int main(int argc, const char *argv[])
{pthread_t id1;int mytype1=atoi(argv[2]);pthread_create(&id1,0,run,&mytype1);int mytype=atoi(argv[1]);key_t key=ftok("./ipc",1);if(key==-1){perror("ftok");return 1;}int id=msgget(key,IPC_CREAT|0666);if(id==-1){perror("msgget");return 1;}struct msgbuf msg;int size=0;signal(SIGINT,handler);while(1){memset(&msg,0,sizeof(msg));msg.mtype=mytype;printf("请输入:");scanf("%128s",msg.mtext);while(getchar()!='\n');size=strlen(msg.mtext);msgsnd(id,&msg,size,0);}return 0;
}

http://www.wooajung.com/news/30605.html

相关文章:

  • 站群推广有哪些方式广州google推广
  • 客户资源管理系统亚马逊排名seo
  • 怎样建设个人游戏网站用今日头条导入自己网站外链
  • foxtable网站开发百度搜索引擎排名规则
  • 闽清建设局网站seo臻系统
  • 网站招生宣传怎么做福州seo按天收费
  • 宁夏公路建设管理局网站关键词歌词任然
  • 网站开发目录结构谷歌商店下载安装
  • 做卖车的网站有哪些免费友链互换
  • 作文网站高中今日油价92汽油价格调整最新消息
  • 免费asp网站空间德兴网站seo
  • 东莞品牌网站设计公司百度seo一本通
  • 广告公司官网做网站seo推广公司
  • 深圳做地铁的公司网站手机网络优化软件
  • 网站后台账户密码如何做线上营销
  • 手机网站怎么上传图片广西壮族自治区免费百度推广
  • 网站专业好找工作吗链接交易网
  • 网站购物车作用百度竞价点击一次多少钱
  • 网站流量用完网络营销是什么专业类别
  • 创世网站网络建设建站优化公司
  • google网站排名企业网站是什么
  • 如何使用框架来建设网站牛排seo系统
  • 虎门镇网站建设百度竞价品牌广告
  • 做三级分销网站公司百度免费推广
  • 茶山网站仿做seo是什么意思知乎
  • 遵义服务好的网站建设公司代运营公司排名
  • 网页设计与制作教学设计360网站关键词排名优化
  • 小兔自助建站视频营销的策略与方法
  • 南宁旅游网站建设爱站网怎么使用
  • 大连企业做网站万网域名官网