您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Bflush函数代码示例

51自学网 2021-06-01 19:54:56
  C++
这篇教程C++ Bflush函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Bflush函数的典型用法代码示例。如果您正苦于以下问题:C++ Bflush函数的具体用法?C++ Bflush怎么用?C++ Bflush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Bflush函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: m_escape

/* *  Output the message body with '^From ' escapes. *  Ensures that any line starting with a 'From ' gets a ' ' stuck *  in front of it. */static intm_escape(message *mp, Biobuf *fp){	char *p, *np;	char *end;	long offset;	int m, n;	char *start;	for(offset = 0; offset < mp->size; offset += n){		n = m_get(mp, offset, &start);		if(n < 0){			Bflush(fp);			return -1;		}		p = start;		for(end = p+n; p < end; p += m){			np = memchr(p, '/n', end-p);			if(np == 0){				Bwrite(fp, p, end-p);				break;			}			m = np - p + 1;			if(m > 5 && strncmp(p, "From ", 5) == 0)				Bputc(fp, ' ');			Bwrite(fp, p, m);		}	}	Bflush(fp);	return 0;}
开发者ID:99years,项目名称:plan9,代码行数:37,


示例2: threadmain

voidthreadmain(int argc, char *argv[]){	int i;	int lineset;	int ifd;	lineset = 0;	Binit(&bout, 1, OWRITE);	while(argc > 1 && argv[1][0] == '-'){		--argc; argv++;		switch(argv[0][1]){		case '/0':			colonflag = 1;			break;		case 't':			tabflag = 0;			break;		default:			linewidth = atoi(&argv[0][1]);			if(linewidth <= 1)				linewidth = WIDTH;			lineset = 1;			break;		}	}	if(lineset == 0)		getwidth();	cbuf = cbufp = malloc(ALLOC_QUANTA*(sizeof *cbuf));	word = malloc(WORD_ALLOC_QUANTA*(sizeof *word));	if(word == 0 || cbuf == 0)		error("out of memory");	if(argc == 1)		readbuf(0);	else{		for(i = 1; i < argc; i++){			if((ifd = open(*++argv, OREAD)) == -1)				fprint(2, "mc: can't open %s (%r)/n", *argv);			else{				readbuf(ifd);				Bflush(&bin);				close(ifd);			}		}	}	columnate();	Bflush(&bout);	threadexitsall(0);}
开发者ID:mkhl,项目名称:plan9port,代码行数:49,


示例3: Bprint

intBprint(Biobuf *bb, char *fmt, ...){	va_list arg;	int n, pcol;	char *ip, *ep, *out;	Biobufhdr *bp = &bb->_h;	va_start(arg, fmt);	ep = (char*)bp->ebuf;	ip = ep + bp->ocount;	pcol = printcol;	out = doprint(ip, ep, fmt, arg);	if(out >= ep-UTFmax-1) {		Bflush(bb);		ip = ep + bp->ocount;		printcol = pcol;		out = doprint(ip, ep, fmt, arg);		if(out >= ep-UTFmax-1) {			va_end(arg);			return Beof;		}	}	n = out-ip;	bp->ocount += n;	va_end(arg);	return n;}
开发者ID:UIKit0,项目名称:newsqueak,代码行数:28,


示例4: winclean

voidwinclean(Window *w){	if(w->body)		Bflush(w->body);	ctlprint(w->ctl, "clean/n");}
开发者ID:Requaos,项目名称:harvey,代码行数:7,


示例5: r_fl

voidr_fl(int argc, Rune **argv){	USED(argc);	USED(argv);	Bflush(&bout);}
开发者ID:00001,项目名称:plan9port,代码行数:7,


示例6: stlscmd

static intstlscmd(char*){	int fd;	TLSconn conn;	if(didtls)		return senderr("tls already started");	if(!tlscert)		return senderr("don't have any tls credentials");	sendok("");	Bflush(&out);	memset(&conn, 0, sizeof conn);	conn.cert = tlscert;	conn.certlen = ntlscert;	if(debug)		conn.trace = trace;	fd = tlsServer(0, &conn);	if(fd < 0)		sysfatal("tlsServer: %r");	dup(fd, 0);	dup(fd, 1);	close(fd);	Binit(&in, 0, OREAD);	Binit(&out, 1, OWRITE);	didtls = 1;	return 0;}
开发者ID:npe9,项目名称:harvey,代码行数:29,


示例7: mk

voidmk(char *target){	Node *node;	int did = 0;	nproc();		/* it can be updated dynamically */	nrep();			/* it can be updated dynamically */	runerrs = 0;	node = graph(target);	if(DEBUG(D_GRAPH)){		dumpn("new target/n", node);		Bflush(&bout);	}	clrmade(node);	while(node->flags&NOTMADE){		if(work(node, (Node *)0, (Arc *)0))			did = 1;	/* found something to do */		else {			if(waitup(1, (int *)0) > 0){				if(node->flags&(NOTMADE|BEINGMADE)){					assert(/*must be run errors*/ runerrs);					break;	/* nothing more waiting */				}			}		}	}	if(node->flags&BEINGMADE)		waitup(-1, (int *)0);	while(jobs)		waitup(-2, (int *)0);	assert(/*target didnt get done*/ runerrs || (node->flags&MADE));	if(did == 0)		Bprint(&bout, "mk: '%s' is up to date/n", node->name);}
开发者ID:99years,项目名称:plan9,代码行数:35,


示例8: putfile

voidputfile(void){	int *a1;	Rune *lp;	long c;	a1 = addr1;	do {		lp = getline(*a1++);		for(;;) {			count++;			c = *lp++;			if(c == 0) {				if(Bputrune(&iobuf, '/n') < 0)					error(Q);				break;			}			if(Bputrune(&iobuf, c) < 0)				error(Q);		}	} while(a1 <= addr2);	if(Bflush(&iobuf) < 0)		error(Q);}
开发者ID:00001,项目名称:plan9port,代码行数:25,


示例9: patch

voidpatch(void){	vlong c, vexit;	Prog *p, *q;	Sym *s;	int a;	if(debug['v'])		Bprint(&bso, "%5.2f patch/n", cputime());	Bflush(&bso);	mkfwd();	s = lookup("exit", 0);	vexit = s->value;	for(p = firstp; p != P; p = p->link) {		a = p->as;		if(a == ATEXT)			curtext = p;		if((a == AJAL || a == AJMP || a == ARET) &&		   p->to.type != D_BRANCH && p->to.sym != S) {			s = p->to.sym;			if(s->type != STEXT) {				diag("undefined: %s/n%P", s->name, p);				s->type = STEXT;				s->value = vexit;			}			p->to.offset = s->value;			p->to.type = D_BRANCH;		}		if(p->to.type != D_BRANCH)			continue;		c = p->to.offset;		for(q = firstp; q != P;) {			if(q->forwd != P)			if(c >= q->forwd->pc) {				q = q->forwd;				continue;			}			if(c == q->pc)				break;			q = q->link;		}		if(q == P) {			diag("branch out of range %lld/n%P", c, p);			p->to.type = D_NONE;		}		p->cond = q;	}	for(p = firstp; p != P; p = p->link) {		if(p->as == ATEXT)			curtext = p;		if(p->cond != P) {			p->cond = brloop(p->cond);			if(p->cond != P)			if(p->to.type == D_BRANCH)				p->to.offset = p->cond->pc;		}	}}
开发者ID:bbarker,项目名称:plan9,代码行数:60,


示例10: wclean

voidwclean(Win *w){	if(w->body)		Bflush(w->body);	ctlwrite(w, "clean/n");}
开发者ID:CoryXie,项目名称:nix-os,代码行数:7,


示例11: threadmain

voidthreadmain(int argc, char *argv[]){	char *errmsg;	int ac;	char *ap, *av[256];	Cmd *cp;	int32_t status;	if (argc > 3) {		print("usage: cifscmd [to [share]]/n");		exits("args");	}	smbglobalsguess(1);	errmsg = nil;	if (Binit(&bin, 0, OREAD) == Beof || Binit(&bout, 1, OWRITE) == Beof) {		fprint(2, "%s: can't init bio: %r/n", argv0);		threadexits("Binit");	}	if (argc > 1) {		c = smbconnect(argv[1], argc == 3 ? argv[2] : nil, &errmsg);		if (c == nil)			fprint(2, "failed to connect: %s/n", errmsg);	}	while (ap = Brdline(&bin, '/n')) {		ap[Blinelen(&bin) - 1] = 0;		switch (ac = parse(ap, av, nelem(av))) {		default:			for (cp = cmd; cp->name; cp++) {				if (strcmp(cp->name, av[0]) == 0)					break;			}			if (cp->name == 0) {				Bprint(&bout, "eh?/n");				break;			}			if (c == 0 && cp->connected) {				Bprint(&bout, "not currently connected/n");				break;			}			if ((status = (*cp->f)(c, ac - 1, &av[1])) != -1) {				if(verbose)					Bprint(&bout, "ok %ld/%ld/n", status >> 16, status & 0xffff);				break;			}			break;		case -1:			Bprint(&bout, "eh?/n");			break;		case 0:			break;		}		Bflush(&bout);	}	threadexits(0);}
开发者ID:bhanug,项目名称:harvey,代码行数:60,


示例12: syswrite

voidsyswrite(int64_t offset){	int fd;	uint32_t size, a;	char *buf;	int n;	fd = getmem_w(reg.r[13]+4);	a = getmem_w(reg.r[13]+8);	size = getmem_w(reg.r[13]+12);	Bflush(bioout);	buf = memio(0, a, size, MemRead);	n = pwrite(fd, buf, size, offset);	if(n < 0)		errstr(errbuf, sizeof errbuf);		if(sysdbg)		itrace("write(%d, %lux, %d, 0x%llx) = %d", fd, a, size, offset, n);	free(buf);	reg.r[REGRET] = n;}
开发者ID:carriercomm,项目名称:legacy,代码行数:25,


示例13: error

voiderror(char *fmt, ...){	int i;	char buf[2048];	va_list arg;	/* Unstack io channels */	if(iop != 0) {		for(i = 1; i < iop; i++)			Bterm(io[i]);		bout = io[0];		iop = 0;	}	ret = 0;	gotint = 0;	Bflush(bout);	if(silent)		silent = 0;	else {		va_start(arg, fmt);		vseprint(buf, buf+sizeof(buf), fmt, arg);		va_end(arg);		fprint(2, "%L: (error) %s/n", buf);	}	while(popio())		;	interactive = 1;	longjmp(err, 1);}
开发者ID:JamesLinus,项目名称:inferno,代码行数:31,


示例14: pipifc

voidpipifc(void){	Ipifc *ip, *nip;	Iplifc *lifc;	char buf[100];	int l, i;	fmtinstall('I', eipfmt);	fmtinstall('M', eipfmt);	ip = readipifc(netroot, nil, -1);	l = 7;	for(nip = ip; nip; nip = nip->next){		for(lifc = nip->lifc; lifc; lifc = lifc->next){			i = snprint(buf, sizeof buf, "%I", lifc->ip);			if(i > l)				l = i;			i = snprint(buf, sizeof buf, "%I", lifc->net);			if(i > l)				l = i;		}	}	for(nip = ip; nip; nip = nip->next){		for(lifc = nip->lifc; lifc; lifc = lifc->next)			Bprint(&out, "%-12s %5d %-*I %5M %-*I %8lud %8lud %8lud %8lud/n",				nip->dev, nip->mtu, 				l, lifc->ip, lifc->mask, l, lifc->net,				nip->pktin, nip->pktout,				nip->errin, nip->errout);	}	Bflush(&out);}
开发者ID:bhanug,项目名称:harvey,代码行数:35,


示例15: cclean

voidcclean(void){	outcode(AEND, Always, &nullgen, NREG, &nullgen);	Bflush(&obuf);}
开发者ID:hfeeki,项目名称:go,代码行数:7,


示例16: codeblk

voidcodeblk(int64 addr, int64 size){	LSym *sym;	int64 eaddr, n;	uchar *q;	if(debug['a'])		Bprint(&bso, "codeblk [%#x,%#x) at offset %#llx/n", addr, addr+size, cpos());	blk(ctxt->textp, addr, size);	/* again for printing */	if(!debug['a'])		return;	for(sym = ctxt->textp; sym != nil; sym = sym->next) {		if(!sym->reachable)			continue;		if(sym->value >= addr)			break;	}	eaddr = addr + size;	for(; sym != nil; sym = sym->next) {		if(!sym->reachable)			continue;		if(sym->value >= eaddr)			break;		if(addr < sym->value) {			Bprint(&bso, "%-20s %.8llux|", "_", (vlong)addr);			for(; addr < sym->value; addr++)				Bprint(&bso, " %.2ux", 0);			Bprint(&bso, "/n");		}		Bprint(&bso, "%.6llux/t%-20s/n", (vlong)addr, sym->name);		n = sym->size;		q = sym->p;		while(n >= 16) {			Bprint(&bso, "%.6ux/t%-20.16I/n", addr, q);			addr += 16;			q += 16;			n -= 16;		}		if(n > 0)			Bprint(&bso, "%.6ux/t%-20.*I/n", addr, (int)n, q);		addr += n;	}	if(addr < eaddr) {		Bprint(&bso, "%-20s %.8llux|", "_", (vlong)addr);		for(; addr < eaddr; addr++)			Bprint(&bso, " %.2ux", 0);	}	Bflush(&bso);}
开发者ID:LEEWEN-DALIAN,项目名称:golang,代码行数:59,


示例17: doprof1

voiddoprof1(void){#if 0	Sym *s;	int32 n;	Prog *p, *q;	if(debug['v'])		Bprint(&bso, "%5.2f profile 1/n", cputime());	Bflush(&bso);	s = lookup("__mcount", 0);	n = 1;	for(cursym = textp; cursym != nil; cursym = cursym->next) {		p = cursym->text;		q = prg();		q->line = p->line;		q->link = datap;		datap = q;		q->as = ADATA;		q->from.type = D_EXTERN;		q->from.offset = n*4;		q->from.sym = s;		q->from.scale = 4;		q->to = p->from;		q->to.type = D_CONST;		q = prg();		q->line = p->line;		q->pc = p->pc;		q->link = p->link;		p->link = q;		p = q;		p->as = AADDL;		p->from.type = D_CONST;		p->from.offset = 1;		p->to.type = D_EXTERN;		p->to.sym = s;		p->to.offset = n*4 + 4;		n += 2;	}	q = prg();	q->line = 0;	q->link = datap;	datap = q;	q->as = ADATA;	q->from.type = D_EXTERN;	q->from.sym = s;	q->from.scale = 4;	q->to.type = D_CONST;	q->to.offset = n;	s->type = SBSS;	s->size = n*4;#endif}
开发者ID:Ahmah2009,项目名称:golang,代码行数:58,


示例18: Cwrite

voidCwrite(Cdimg *cd, void *buf, int n){	assert(Boffset(&cd->bwr) >= 16*Blocksize);	if(Bwrite(&cd->bwr, buf, n) != n)		sysfatal("Bwrite: %r");	Bflush(&cd->brd);}
开发者ID:00001,项目名称:plan9port,代码行数:9,


示例19: Bclean

voidBclean(Buffer *b){	if(b->dirty){		Bflush(b);		b->c1 = b->c2 = 0;		Strzero(&b->cache);	}}
开发者ID:4ad,项目名称:sam,代码行数:9,


示例20: vncflush

voidvncflush(Vnc *v){	if(Bflush(&v->out) < 0){		if(verbose > 1)			fprint(2, "hungup while sending flush: %r/n");		vnchungup(v);	}}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:9,


示例21: m_noescape

/* output the message body without ^From escapes */static intm_noescape(message *mp, Biobuf *fp){	long offset;	int n;	char *p;	for(offset = 0; offset < mp->size; offset += n){		n = m_get(mp, offset, &p);		if(n <= 0){			Bflush(fp);			return -1;		}		if(Bwrite(fp, p, n) < 0)			return -1;	}	return Bflush(fp);}
开发者ID:99years,项目名称:plan9,代码行数:19,


示例22: Ssyscall

voidSsyscall(uint32_t){	int call;	call = reg.r[REGARG];	if(call < 0 || call >= nelem(systab) || systab[call] == nil) {		Bprint(bioout, "bad system call %d (%#ux)/n", call, call);		dumpreg();		Bflush(bioout);		return;	}	if(trace)		itrace("SWI/t%s", sysctab[call]);	(*systab[call])();	Bflush(bioout);}
开发者ID:carriercomm,项目名称:legacy,代码行数:18,


示例23: errprint

/* * print accumulated error reports */voiderrprint(void){	Bflush(&bout);	for(; err != 0; err = err->e_nextp) {		cerror(err->e_mess);		fprint(2, "/n");	}}
开发者ID:00001,项目名称:plan9port,代码行数:12,


示例24: dBprint

intdBprint(char *fmt, ...){	char buf[SIZE], *out;	va_list arg;	int n;	va_start(arg, fmt);	out = vseprint(buf, buf+SIZE, fmt, arg);	va_end(arg);	if(debug){		Bwrite(&berr, buf, (long)(out-buf));		Bflush(&berr);	}	n = Bwrite(&bout, buf, (long)(out-buf));	Bflush(&bout);	return n;}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:18,


示例25: wwritebody

voidwwritebody(Win *w, char *s, int n){	if(w->body == nil)		openbody(w, OWRITE);	if(Bwrite(w->body, s, n) != n)		  fprint(2,"write error to window: %r");	Bflush(w->body);}
开发者ID:CoryXie,项目名称:nix-os,代码行数:9,


示例26: astro

voidastro(char *flags, int initial){	int p[2];	int i, n, np;	char cmd[256], buf[4096], *lines[20], *fld[10];	snprint(cmd, sizeof cmd, "/bin/astro -p %s", flags);	if(pipe(p) < 0){		fprint(2, "can't pipe: %r/n");		return;	}	if(runcommand(cmd, p) < 0){		close(p[0]);		close(p[1]);		fprint(2, "can't run astro: %r");		return;	}	close(p[1]);	n = readn(p[0], buf, sizeof buf-1);	if(n <= 0){		fprint(2, "no data from astro/n");		return;	}	if(!initial)		Bwrite(&bout, buf, n);	buf[n] = '/0';	np = getfields(buf, lines, nelem(lines), 0, "/n");	if(np <= 1){		fprint(2, "astro: not enough output/n");		return;	}	Bprint(&bout, "%s/n", lines[0]);	Bflush(&bout);	/* get latitude and longitude */	if(getfields(lines[0], fld, nelem(fld), 1, " ") < 8)		fprint(2, "astro: can't read longitude: too few fields/n");	else{		mysid = getra(fld[5])*180./PI;		mylat = getra(fld[6])*180./PI;		mylon = getra(fld[7])*180./PI;	}	/*	 * Each time we run astro, we generate a new planet list	 * so multiple appearances of a planet may exist as we plot	 * its motion over time.	 */	planet = malloc(NPlanet*sizeof planet[0]);	if(planet == nil){		fprint(2, "astro: malloc failed: %r/n");		exits("malloc");	}	memset(planet, 0, NPlanet*sizeof planet[0]);	for(i=1; i<np; i++)		parseplanet(lines[i], &planet[i-1]);}
开发者ID:aahud,项目名称:harvey,代码行数:56,


示例27: getrange

uchar*getrange(Block *b){	uchar *data;	char *status;	int netfd;	static Biobuf netbio;	b->len = Blocksize;	if(b->off + b->len > size)		b->len = size - b->off;	if(debug)		print("getrange: %lld %lld/n", b->off, b->len);	netfd = dialhttp(&netbio);	fprint(netfd, 		"GET %s HTTP/1.1/r/n"		"Host: %s/r/n"		"Accept-Encoding:/r/n"		"Range: bytes=%lld-%lld/r/n"		"/r/n",		get, host, b->off, b->off+b->len);	Bflush(&netbio);	status = readhttphdr(&netbio, nil);	if(status == nil)		return nil;	/*	 * Some servers (e.g., www.google.com) return 200 OK	 * when you ask for the entire page in one range.	 */	if(strstr(status, "206 Partial Content")==nil	&& (b->off!=0 || b->len!=size || strstr(status, "200 OK")==nil)){		free(status);		close(netfd);		werrstr("did not get requested range");		return nil;	}	free(status);	data = emalloc9p(b->len);	if(Bread(&netbio, data, b->len) != b->len){		free(data);		close(netfd);		werrstr("not enough bytes read");		return nil;	}	b->p = data;	close(netfd);	return data;}
开发者ID:99years,项目名称:plan9,代码行数:56,


示例28: cclean

voidcclean(void){	Gen2 g2;	g2.from = nullgen;	g2.to = nullgen;	outcode(AEND, &g2);	Bflush(&obuf);}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:10,


示例29: warning

voidwarning(char *s,...){	va_list argl;	va_start(argl, s);	printerr("Warning", s, argl);	va_end(argl);	Bflush(&fout);}
开发者ID:00001,项目名称:plan9port,代码行数:10,


示例30: main

voidmain(int argc, char **argv){	int fd, ofd;	char diffout[40], idiffout[40];	Biobuf *b1, *b2, bdiff, bout, bstdout;	Dir *d;	ARGBEGIN{	default:		usage();	case 'b':		diffbflag++;		break;	case 'w':		diffwflag++;		break;	}ARGEND	if(argc != 2)		usage();	if((d = dirstat(argv[0])) == nil)		sysfatal("stat %s: %r", argv[0]);	if(d->mode&DMDIR)		sysfatal("%s is a directory", argv[0]);	free(d);	if((d = dirstat(argv[1])) == nil)		sysfatal("stat %s: %r", argv[1]);	if(d->mode&DMDIR)		sysfatal("%s is a directory", argv[1]);	free(d);	if((b1 = Bopen(argv[0], OREAD)) == nil)		sysfatal("open %s: %r", argv[0]);	if((b2 = Bopen(argv[1], OREAD)) == nil)		sysfatal("open %s: %r", argv[1]);	strcpy(diffout, "/tmp/idiff.XXXXXX");	fd = opentemp(diffout, ORDWR|ORCLOSE, 0);	strcpy(idiffout, "/tmp/idiff.XXXXXX");	ofd = opentemp(idiffout, ORDWR|ORCLOSE, 0);	rundiff(argv[0], argv[1], fd);	seek(fd, 0, 0);	Binit(&bdiff, fd, OREAD);	Binit(&bout, ofd, OWRITE);	idiff(b1, argv[0], b2, argv[1], &bdiff, diffout, &bout, idiffout);	Bterm(&bdiff);	Bflush(&bout);	seek(ofd, 0, 0);	Binit(&bout, ofd, OREAD);	Binit(&bstdout, 1, OWRITE);	copy(&bout, idiffout, &bstdout, "<stdout>");	exits(nil);}
开发者ID:99years,项目名称:plan9,代码行数:55,



注:本文中的Bflush函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Bgetc函数代码示例
C++ BeginTransaction函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。