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

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

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

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

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

示例1: Breadnumber

static intBreadnumber(Biobuf *b, char *buf){	int i;	int c;	int havedigits;		havedigits = 0;	for(i=0; i<22; i++){		if((c = Bgetc(b)) == Beof)			return -1;		if('0' <= c && c <= '9'){			*buf++ = c;			havedigits = 1;		}else if(c == ' '){			if(havedigits){				while((c = Bgetc(b)) == ' ')					;				if(c != Beof)					Bungetc(b);				break;			}		}else{			werrstr("bad character %.2x", c);			return -1;		}	}	*buf = 0;	return 0;}
开发者ID:aahud,项目名称:harvey,代码行数:30,


示例2: readline

static intreadline(Biobuf *bp, char *buf){	int c;	char *p, *e;	p = buf;	e = p + MAXLINELEN-1;	do {		c = Bgetc(bp);		if (c < 0) {			if (p == buf)				return -1;			break;		}		if (c == '/n')			break;		*p++ = c;	} while (p < e);	*p = 0;	if (c != '/n' && c >= 0) {		do c = Bgetc(bp);		while (c >= 0 && c != '/n');	}	return p - buf;}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:26,


示例3: Bgetrune

longBgetrune(Biobuf *bp){	int c, i;	Rune rune;	char str[UTFmax];	c = Bgetc(bp);	if(c < Runeself) {		/* one char */		bp->runesize = 1;		return c;	}	str[0] = c;	for(i=1;;) {		c = Bgetc(bp);		if(c < 0)			return c;		str[i++] = c;		if(fullrune(str, i)) {			bp->runesize = chartorune(&rune, str);			while(i > bp->runesize) {				Bungetc(bp);				i--;			}			return rune;		}	}}
开发者ID:GregBowyer,项目名称:wmii,代码行数:30,


示例4: pass1

static char *pass1(State *s, char *buf, int *alloc){	int c, t, used, state;	enum { Lost, String, Cplusplus, Comment };	used = 0;	state = Lost;	while((c = Bgetc(s->bp)) != -1){		if(c == '/n'){			s->line++;			if(state == Cplusplus)				state = Lost;		}		if(c == '/'){			t = Bgetc(s->bp);			if(t == '*' && state == Lost)				state = Comment;			else			if(t == '/' && state == Lost)				state = Cplusplus;			else				Bungetc(s->bp);		}		if(c == '*'){			t = Bgetc(s->bp);			if(t == '/' && state == Comment){				state = Lost;				c = ' ';			}			else				Bungetc(s->bp);		}		if(c == '//'){			t = Bgetc(s->bp);			if(t == '/n')				c = ' ';			else				Bungetc(s->bp);		}		if(c == '/n' && state == Lost)			break;		if(state != Comment && state != Cplusplus){			if(used >= *alloc-1){				*alloc += Memchunk;				buf = erealloc(buf, *alloc);			}			buf[used++] = c;		}	}	if(c == -1)		return nil;	buf[used] = 0;	return buf;}
开发者ID:staalmannen,项目名称:p9p-mkmk,代码行数:59,


示例5: Bgetle2

intBgetle2(Biobuf *bp){	int l, h;	l = Bgetc(bp);	h = Bgetc(bp);	return l|(h<<8);}
开发者ID:29decibel,项目名称:golang,代码行数:9,


示例6: _read5

int_read5(Biobuf *bp, Prog *p){	int as, n;	Addr a;	as = Bgetc(bp);			/* as */	if(as < 0)		return 0;	p->kind = aNone;	p->sig = 0;	if(as == ANAME || as == ASIGNAME){		if(as == ASIGNAME){			Bread(bp, &p->sig, 4);			p->sig = leswal(p->sig);		}		p->kind = aName;		p->type = type2char(Bgetc(bp));		/* type */		p->sym = Bgetc(bp);			/* sym */		n = 0;		for(;;) {			as = Bgetc(bp);			if(as < 0)				return 0;			n++;			if(as == 0)				break;		}		p->id = malloc(n);		if(p->id == 0)			return 0;		Bseek(bp, -n, 1);		if(Bread(bp, p->id, n) != n)			return 0;		return 1;	}	if(as == ATEXT)		p->kind = aText;	else if(as == AGLOBL)		p->kind = aData;	skip(bp, 6);		/* scond(1), reg(1), lineno(4) */	a = addr(bp);	addr(bp);	if(a.type != D_OREG || a.name != D_STATIC && a.name != D_EXTERN)		p->kind = aNone;	p->sym = a.sym;	return 1;}
开发者ID:Alfalfamale,项目名称:robvdhout-go,代码行数:48,


示例7: varread

voidvarread(void)	/* read into variable */{	Datum d;	extern Biobuf *bin;	Symbol *var = (Symbol *) *pc++;	int c;  Again:	do		c = Bgetc(bin);	while(c==' ' || c=='/t' || c=='/n');	if(c == Beof){  Iseof:		if(moreinput())			goto Again;		d.val = var->u.val = 0.0;		goto Return;	}	if(strchr("+-.0123456789", c) == 0)		execerror("non-number read into", var->name);	Bungetc(bin);	if(Bgetd(bin, &var->u.val) == Beof)		goto Iseof;	else		d.val = 1.0;  Return:	var->type = VAR;	push(d);}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:31,


示例8: readc

intreadc(void){loop:	if((readptr != &readstk[0]) && (*readptr != 0)) {		if(sfeof(*readptr) == 0)			return(lastchar = sgetc(*readptr));		release(*readptr);		readptr--;		goto loop;	}	lastchar = Bgetc(curfile);	if(lastchar != -1)		return(lastchar);	if(readptr != &readptr[0]) {		readptr--;		if(*readptr == 0)			curfile = &bin;		goto loop;	}	if(curfile != &bin) {		Bterm(curfile);		curfile = &bin;		goto loop;	}	exits(0);	return 0;	/* shut up ken */}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:28,


示例9: pcollgnextoff

int32_tpcollgnextoff(int32_t fromoff){	int c, state = 0, defoff = -1;	if(Bseek(bdict, fromoff, 0) < 0)		return -1;	while((c = Bgetc(bdict)) >= 0){		if(c == '/r')			defoff = Boffset(bdict);		switch(state){		case 0:			if(c == 0x05)				state = 1;			break;		case 1:			if(c == 'h')				state = 2;			else				state = 0;			break;		case 2:			if(c == 0x06)				return (Boffset(bdict)-3);			else				state = 0;			break;		}	}	return defoff;}
开发者ID:Requaos,项目名称:harvey,代码行数:31,


示例10: getpassword

static intgetpassword(char *buf, char *e){	char *p;	int c;	int consctl, rv = 0;	consctl = open("/dev/consctl", OWRITE);	if(consctl >= 0)		write(consctl, "rawon", 5);	print("Password: ");	e--;	for(p = buf; p <= e; p++){		c = Bgetc(&stdin);		if(c < 0){			rv = -1;			goto out;		}		if(c == '/n' || c == '/r')			break;		*p = c;	}	*p = 0;	print("/n");out:	if(consctl >= 0)		close(consctl);	return rv;}
开发者ID:99years,项目名称:plan9,代码行数:30,


示例11: escchar

intescchar(char c){	int n;	char buf[32];	if(c >= '0' && c <= '9') {		n = 1;		buf[0] = c;		for(;;) {			c = Bgetc(bin);			if(c == Eof)				fatal("%d: <eof> in escape sequence", line);			if(strchr("0123456789xX", c) == 0) {				Bungetc(bin);				break;			}			buf[n++] = c;		}		buf[n] = '/0';		return strtol(buf, 0, 0);	}	n = cmap[c];	if(n == 0)		return c;	return n-1;}
开发者ID:BGCX261,项目名称:znos-git,代码行数:28,


示例12: getcrnl

/* *  get a line that ends in crnl or cr, turn terminating crnl into a nl * *  return 0 on EOF */static intgetcrnl(char *buf, int n){	int c;	char *ep;	char *bp;	Biobuf *fp = &in;	Bflush(&out);	bp = buf;	ep = bp + n - 1;	while(bp != ep){		c = Bgetc(fp);		if(debug) {			seek(2, 0, 2);			fprint(2, "%c", c);		}		switch(c){		case -1:			*bp = 0;			if(bp==buf)				return 0;			else				return bp-buf;		case '/r':			c = Bgetc(fp);			if(c == '/n'){				if(debug) {					seek(2, 0, 2);					fprint(2, "%c", c);				}				*bp = 0;				return bp-buf;			}			Bungetc(fp);			c = '/r';			break;		case '/n':			*bp = 0;			return bp-buf;		}		*bp++ = c;	}	*bp = 0;	return bp-buf;}
开发者ID:npe9,项目名称:harvey,代码行数:52,


示例13: peek

intpeek(void){	if (ugtop > 0)		return ugbuf[ugtop-1];	ugbuf[ugtop] = Bgetc(bdf);	return ugbuf[ugtop++];}
开发者ID:9nut,项目名称:plan9,代码行数:8,


示例14: pgwnextoff

/* * Return offset into bdict where next webster entry after fromoff starts. * Webster entries start with <p><hw> */longpgwnextoff(long fromoff){    long a, n;    int c;    a = Bseek(bdict, fromoff, 0);    if(a != fromoff)        return -1;    n = 0;    for(;;) {        c = Bgetc(bdict);        if(c < 0)            break;        if(c == '<' && Bgetc(bdict) == 'p' && Bgetc(bdict) == '>') {            c = Bgetc(bdict);            if(c == '<') {                if (Bgetc(bdict) == 'h' && Bgetc(bdict) == 'w'                        && Bgetc(bdict) == '>')                    n = 7;            } else if (c == '{')                n = 4;            if(n)                break;        }    }    return (Boffset(bdict)-n);}
开发者ID:aberg001,项目名称:plan9,代码行数:32,


示例15: getnext

char *getnext(int must){	int c;	char *beg;	int prect,nlct;	prect = nlct = 0;	if(tptr > lastplace){		tptr = lastplace = temp;		err = 0;		inswitch = 0;	}	tp = lastplace;	if(inswitch && tptr <= lastplace)		if (isalnum((uchar)*lastplace)||ispunct((uchar)*lastplace)||isop((uchar)*lastplace))return(lastplace);space:	while(isspace(c=Bgetc(input)))puttmp(c,1);	beg = tp;	puttmp(c,1);	if(c == '/'){		if(puttmp(Bgetc(input),1) == '*'){cont:			while((c=Bgetc(input)) != '*'){				puttmp(c,0);				if(must == 0 && c == '/n')					if(nlct++ > 2)goto done;			}			puttmp(c,1);	star:			if(puttmp((c=Bgetc(input)),1) == '/'){				beg = tp;				puttmp((c=Bgetc(input)),1);			}			else if(c == '*')goto star;			else goto cont;		}		else goto done;	}	if(isspace(c))goto space;	if(c == '#' && tp > temp+1 && *(tp-2) == '/n'){		if(prect++ > 2)goto done;		while(puttmp((c=Bgetc(input)),1) != '/n')			if(c == '//')puttmp(Bgetc(input),1);		goto space;	}	if(isalnum(c)){		while(isalnum(c = Bgetc(input)))puttmp(c,1);		Bungetc(input);	}done:	puttmp('/0',1);	lastplace = tp-1;	inswitch = 1;	return(beg);}
开发者ID:00001,项目名称:plan9port,代码行数:54,


示例16: rdline

/*  Append an input line to a String. * *  Empty lines and leading whitespace are removed. */static char *rdline(Biobuf *fp, String *to){	int c;	int len = 0;	c = Bgetc(fp);	/* eat leading white */	while(c==' ' || c=='/t' || c=='/n' || c=='/r')		c = Bgetc(fp);	if(c < 0)		return 0;	for(;;){		switch(c) {		case -1:			goto out;		case '//':			c = Bgetc(fp);			if (c != '/n') {				s_putc(to, '//');				s_putc(to, c);				len += 2;			}			break;		case '/r':			break;		case '/n':			if(len != 0)				goto out;			break;		default:			s_putc(to, c);			len++;			break;		}		c = Bgetc(fp);	}out:	s_terminate(to);	return to->ptr - len;}
开发者ID:aahud,项目名称:harvey,代码行数:48,


示例17: zsym

static Sym*zsym(char *pn, Biobuf *f, Sym *h[]){		int o;		o = Bgetc(f);	if(o < 0 || o >= NSYM || h[o] == nil)		mangle(pn);	return h[o];}
开发者ID:machinaut,项目名称:go,代码行数:10,


示例18: get1

static intget1(Biobuf *b){	int c;	c = Bgetc(b);	if(c < 0)		sysfatal("unexpected eof");	return c;}
开发者ID:rminnich,项目名称:harvey,代码行数:10,


示例19: get1

static intget1(Biobuf *b){	int c;	c = Bgetc(b);	if(c < 0)		error("unexpected eof reading file information");	return c;}
开发者ID:bhanug,项目名称:harvey,代码行数:10,


示例20: GETC

static intGETC(void){	int c;	c = Bgetc(&fin);	if(c == '/n')		lineno++;	return c;}
开发者ID:lufia,项目名称:wf,代码行数:10,


示例21: eatstring

voideatstring(void){	String *s;	int esc, c, cnt;	esc = 0;	for(cnt = 0;;) {		c = Bgetc(bin);		switch(c) {		case Eof:			fatal("%d: <eof> in string constant", line);		case '/n':			line++;			diag("newline in string constant");			goto done;		case '//':			if(esc) {				if(cnt >= bufmax)					resizebuf();				strbuf[cnt++] = c;				esc = 0;				break;			}			esc = 1;			break;		case '"':			if(esc == 0)				goto done;			/* Fall through */		default:			if(esc) {				c = escchar(c);				esc = 0;			}			if(cnt >= bufmax)				resizebuf();			strbuf[cnt++] = c;			break;		}	}done:	if(cnt >= bufmax)		resizebuf();	strbuf[cnt] = '/0';	s = malloc(sizeof(String));	s->len = cnt+1;	s->string = malloc(s->len);	memmove(s->string, strbuf, s->len);	yylval.string = s;}
开发者ID:BGCX261,项目名称:znos-git,代码行数:55,


示例22: getcrnl

/* *  get a line that ends in crnl or cr, turn terminating crnl into a nl * *  return 0 on EOF */static intgetcrnl(String *s, Biobuf *fp){	int c;	for(;;){		c = Bgetc(fp);		if(debug) {			seek(2, 0, 2);			fprint(2, "%c", c);		}		switch(c){		case 0:			break;		case -1:			goto out;		case '/r':			c = Bgetc(fp);			if(c == '/n'){				if(debug) {					seek(2, 0, 2);					fprint(2, "%c", c);					stamp();				}				s_putc(s, '/n');				goto out;			}			Bungetc(fp);			s_putc(s, '/r');			break;		case '/n':			s_putc(s, c);			goto out;		default:			s_putc(s, c);			break;		}	}out:	s_terminate(s);	return s_len(s);}
开发者ID:99years,项目名称:plan9,代码行数:47,


示例23: assline

/* *	Assemble a line skipping blank lines, comments, and eliding *	escaped newlines */intassline(Biobuf *bp, Bufblock *buf){	int c;	int lastc;	buf->current=buf->start;	while ((c = nextrune(bp, 1)) >= 0){		switch(c)		{		case '/r':		/* consumes CRs for Win95 */			continue;		case '/n':			if (buf->current != buf->start) {				insert(buf, 0);				return 1;			}			break;		/* skip empty lines */		case '//':		case '/'':		case '"':			rinsert(buf, c);			if (escapetoken(bp, buf, 1, c) == 0)				Exit();			break;		case '`':			if (bquote(bp, buf) == 0)				Exit();			break;		case '#':			lastc = '#';			while ((c = Bgetc(bp)) != '/n') {				if (c < 0)					goto eof;				if(c != '/r')					lastc = c;			}			mkinline++;			if (lastc == '//')				break;		/* propagate escaped newlines??*/			if (buf->current != buf->start) {				insert(buf, 0);				return 1;			}			break;		default:			rinsert(buf, c);			break;		}	}eof:	insert(buf, 0);	return *buf->start != 0;}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:58,


示例24: Bgetdf

static intBgetdf(void *vp){	int c;	struct bgetd *bg = vp;	c = Bgetc(bg->b);	if(c == Beof)		bg->eof = 1;	return c;}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:11,


示例25: Bgetline

void	Bgetline(Biobuf *bp, char *s)	/* get a line, including newline */{	int c;	while ((c = Bgetc(bp)) >= 0) {		*s++ = c;		if (c == '/n')			break;	}	*s = 0;}
开发者ID:00001,项目名称:plan9port,代码行数:11,


示例26: getc

intgetc(void){	if(input == nil)		return Beof;	if(input->fd)		return Bgetc(input->fd);	if(input->s < input->end)		return *(input->s)++;	return -1;}
开发者ID:99years,项目名称:plan9,代码行数:11,


示例27: getcrnl

/* *  Get a line including a crnl into a string.  Convert crnl into nl. */char *getcrnl(String *s){	int c;	int count;	count = 0;	for(;;){		c = Bgetc(&bin);		if(debug)			Bputc(&berr, c);		switch(c){		case -1:			s_append(s, "connection closed unexpectedly by remote system");			s_terminate(s);			return 0;		case '/r':			c = Bgetc(&bin);			if(c == '/n'){		case '/n':				s_putc(s, c);				if(debug)					Bputc(&berr, c);				count++;				s_terminate(s);				return s->ptr - count;			}			Bungetc(&bin);			s_putc(s, '/r');			if(debug)				Bputc(&berr, '/r');			count++;			break;		default:			s_putc(s, c);			count++;			break;		}	}}
开发者ID:grobe0ba,项目名称:plan9front,代码行数:43,


示例28: Bgetstr

void	Bgetstr(Biobuf *bp, char *s)	/* get a string */{	int c;	while ((c = Bgetc(bp)) >= 0) {		if (c == ' ' || c == '/t' || c == '/n') {			Bungetc(bp);			break;		}		*s++ = c;	}	*s = 0;}
开发者ID:00001,项目名称:plan9port,代码行数:13,


示例29: getch

intgetch(void){	int c;	if (ugtop > 0) {		if (ugbuf[--ugtop] == '/n') yyline++;		return ugbuf[ugtop];	}	c = Bgetc(bdf);	if (c == '/n') yyline++;	return c;}
开发者ID:9nut,项目名称:plan9,代码行数:13,


示例30: dodecode

staticvoiddodecode(Biobuf *infile, Pix  *a, int nx, int ny, uint8_t *nbitplanes){	int nel, nx2, ny2, bits, mask;	Pix *aend, px;	nel = nx*ny;	nx2 = (nx+1)/2;	ny2 = (ny+1)/2;	memset(a, 0, nel*sizeof(*a));	/*	 * Initialize bit input	 */	start_inputing_bits();	/*	 * read bit planes for each quadrant	 */	qtree_decode(infile, &a[0],          ny, nx2,  ny2,  nbitplanes[0]);	qtree_decode(infile, &a[ny2],        ny, nx2,  ny/2, nbitplanes[1]);	qtree_decode(infile, &a[ny*nx2],     ny, nx/2, ny2,  nbitplanes[1]);	qtree_decode(infile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]);	/*	 * make sure there is an EOF symbol (nybble=0) at end	 */	if(input_nybble(infile) != 0){		fprint(2, "dodecode: bad bit plane values/n");		exits("format");	}	/*	 * get the sign bits	 */	aend = &a[nel];	mask = 0;	bits = 0;;	for(; a<aend; a++) {		if(px = *a) {			if(mask == 0) {				mask = 0x80;				bits = Bgetc(infile);			}			if(mask & bits)				*a = -px;			mask >>= 1;		}	}}
开发者ID:aahud,项目名称:harvey,代码行数:51,



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


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