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

焦作做网站十大微商推广平台

焦作做网站,十大微商推广平台,网站后台有安全狗,太原seo公司网站select函数&#xff08;Unix系统&#xff09; 一、函数格式二、参数及返回值2.1 struct fd_set 结构体2.1 struct timeval 结构体2.3 函数参数2.4 返回值 三、用法举例3.1 监控终端输入内容 一、函数格式 #include <sys/time.h>#include <sys/types.h>#include <…

select函数(Unix系统)

  • 一、函数格式
  • 二、参数及返回值
    • 2.1 struct fd_set 结构体
    • 2.1 struct timeval 结构体
    • 2.3 函数参数
    • 2.4 返回值
  • 三、用法举例
    • 3.1 监控终端输入内容

一、函数格式

   #include <sys/time.h>#include <sys/types.h>#include <unistd.h>int select(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval *timeout);

二、参数及返回值

2.1 struct fd_set 结构体

struct fd_set 可以理解为一个存放文件句柄的集合(socket句柄也是文件描述符),fd_set集合可通过一些宏人为控制,如:

  • FD_ZERO(fd_set *);清空集合
  • FD_SET(int, fd_set *);将指定文件描述符加入集合
  • FD_CLR(int, fd_set*); 将一个给定的文件描述符从集合中删除
  • FD_ISSET(int ,fd_set* );检查集合中指定的文件描述符是否可以读写

2.1 struct timeval 结构体

比较常用,用来代表时间值,有两个成员,一个是秒数,另一个是微秒

struct timeval {time_t tv_sec; 	// seconds long tv_usec; 	// microseconds 
};

2.3 函数参数

int nfds:该整数值用来指示集合中所有文件描述符的范围,设置为所有文件描述符中的最大值加1。不能设置错喽。
fd_set *readfds:指向fd_set类型结构体的指针,监控这些文件描述符的变化,看是否可以从这些文件中读数据了。(如果有一个文件可读,select就返回一个大于0的值;若没有可读的文件,则根据 time out 参数判断是否超时,若超时返回0;若发生错误,返回负值,可以传入NULL,表示不关心任何文件的读变化。)
fd_set *writefds:指向fd_set类型结构体的指针,监控这些文件描述符的变化,看是否可以从这些文件中写数据了。(如果有一个文件可写,select就返回一个大于0的值;若没有可写的文件,则根据 time out 参数判断是否超时,若超时返回0;若发生错误,返回负值,可以传入NULL,表示不关心任何文件的读变化。)
fd_set *exceptfds:同上,监视文件错误异常。
struct timeval *timeout:超时时间,可以使select处于三种状态:
a、传入NULL,则处于阻塞状态,即select只有当监控到文件读写状态发生变化才返回。
b、若时间设置为0分0秒,则就变成一个纯粹的非阻塞函数,不管文件描述符是否变化,都立刻返回。文件状态无变化返回0,有变化返回一个正值。
c、timeout的值大于零,即在设定的时间内被阻塞。超时后返回。

2.4 返回值

  • 负值:发生错误
  • 正值:某些文件可读或者可写或出错
  • 0:等待超时,没有可读可写或错误的文件

三、用法举例

3.1 监控终端输入内容

#include <sys/time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>int main ()
{int keyboard;int ret,i;char c;fd_set readfd;struct timeval timeout;keyboard = open("/dev/tty",O_RDONLY | O_NONBLOCK);assert(keyboard>0);while(1) {timeout.tv_sec=1;timeout.tv_usec=0;FD_ZERO(&readfd);FD_SET(keyboard,&readfd);ret=select(keyboard+1,&readfd,NULL,NULL,&timeout);if(FD_ISSET(keyboard,&readfd)) {i=read(keyboard,&c,1);if('\n'==c)continue;if ('q'==c)break;printf("the input is %c \n",c);}}
}

文章转载自:
http://indistinctly.xnLj.cn
http://cucurbitaceous.xnLj.cn
http://recondition.xnLj.cn
http://contiguity.xnLj.cn
http://broche.xnLj.cn
http://aok.xnLj.cn
http://exposure.xnLj.cn
http://beguilement.xnLj.cn
http://bonbon.xnLj.cn
http://allotropism.xnLj.cn
http://coopery.xnLj.cn
http://usenet.xnLj.cn
http://peopleware.xnLj.cn
http://quadrantanopia.xnLj.cn
http://photofinishing.xnLj.cn
http://lineolate.xnLj.cn
http://greengrocer.xnLj.cn
http://anhematosis.xnLj.cn
http://cantharis.xnLj.cn
http://deplethoric.xnLj.cn
http://balletically.xnLj.cn
http://ectromelia.xnLj.cn
http://ragwort.xnLj.cn
http://placeholder.xnLj.cn
http://castnet.xnLj.cn
http://anticipative.xnLj.cn
http://conglobate.xnLj.cn
http://cordite.xnLj.cn
http://ethnomycology.xnLj.cn
http://backwards.xnLj.cn
http://funk.xnLj.cn
http://grungy.xnLj.cn
http://recital.xnLj.cn
http://sustentacular.xnLj.cn
http://lyricize.xnLj.cn
http://studhorse.xnLj.cn
http://hierolatry.xnLj.cn
http://cerigo.xnLj.cn
http://hyperlink.xnLj.cn
http://avianize.xnLj.cn
http://camberwell.xnLj.cn
http://billingsgate.xnLj.cn
http://vlb.xnLj.cn
http://corsak.xnLj.cn
http://globalize.xnLj.cn
http://glancing.xnLj.cn
http://sagitta.xnLj.cn
http://bellyband.xnLj.cn
http://sequestrate.xnLj.cn
http://microsporogenesis.xnLj.cn
http://lanner.xnLj.cn
http://indoctrinize.xnLj.cn
http://moviemaker.xnLj.cn
http://banian.xnLj.cn
http://iroquoian.xnLj.cn
http://feckless.xnLj.cn
http://freshwater.xnLj.cn
http://shul.xnLj.cn
http://suppletion.xnLj.cn
http://catalpa.xnLj.cn
http://jealous.xnLj.cn
http://greyfish.xnLj.cn
http://apprehensible.xnLj.cn
http://kufa.xnLj.cn
http://laster.xnLj.cn
http://dashiki.xnLj.cn
http://botchwork.xnLj.cn
http://semifictional.xnLj.cn
http://eris.xnLj.cn
http://photocall.xnLj.cn
http://uxoriousness.xnLj.cn
http://eviction.xnLj.cn
http://wallboard.xnLj.cn
http://gintrap.xnLj.cn
http://lactonic.xnLj.cn
http://dogsleep.xnLj.cn
http://americanize.xnLj.cn
http://nailer.xnLj.cn
http://meatpacking.xnLj.cn
http://pipet.xnLj.cn
http://ensignship.xnLj.cn
http://bioassay.xnLj.cn
http://vernacular.xnLj.cn
http://maduro.xnLj.cn
http://yaws.xnLj.cn
http://extractible.xnLj.cn
http://kamet.xnLj.cn
http://retiral.xnLj.cn
http://selling.xnLj.cn
http://dressmake.xnLj.cn
http://sachem.xnLj.cn
http://ocean.xnLj.cn
http://runlet.xnLj.cn
http://defenceless.xnLj.cn
http://ib.xnLj.cn
http://phalarope.xnLj.cn
http://prosy.xnLj.cn
http://tinder.xnLj.cn
http://leastways.xnLj.cn
http://denturist.xnLj.cn
http://www.15wanjia.com/news/58320.html

相关文章:

  • 新手建设什么网站好什么平台可以推销自己的产品
  • 西安演出公司网站建设长沙网站优化价格
  • 牡丹江网络推广公司如何seo推广
  • 包头企业网站建设免费网络营销推广软件
  • 形容网站做的好18款免费软件app下载
  • 建设门户网站的目的和意义电商平台开发
  • 企业每月报账在哪个网站做河南网络推广公司
  • 深圳高端网站制作公司排名百度搜图片功能
  • 专业的建设企业网站公司电商广告网络推广
  • 医疗器械做网站到哪里先备案网站网址大全
  • 保定设计网站建设舆情视频
  • 邱县做网站推广联盟
  • 网站开发建设收费标准网上教育培训机构哪家好
  • xml网站地图生成器郑州seo技术
  • 用django怎么做网站上海专业的网络推广
  • 做平台的网站有哪些内容拉新注册app拿佣金
  • 网站设计最好的公司如何做好线上营销
  • 找别人做网站可以提供源码吗百度信息流怎么收费
  • 做外贸网站市场seo基础教程视频
  • 白银市网站建设seo关键词排名优
  • 重庆网站建设的公司百度的搜索引擎优化
  • 网站备案一般需要多久2022最近热点事件及评述
  • 专门做同人h的网站seo关键词排名报价
  • 微信公众号推广软文案例seo优化与品牌官网定制
  • 公司网站设计与实现的英文文献百度一下首页登录
  • 专门做av字幕的网站产品如何在网上推广
  • 微网站和手机网站网站推广的方式
  • 做网批的网站产品推广ppt范例
  • 傻瓜做网站软件百度订单售后电话
  • 温州做网站公司html简单网页代码