• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ARGF函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int
main(int argc, char *argv[]) {
	prog = argv[0];

	fps_flag = (getenv("FPS") != NULL);

	load_config("lsc");
	init_font_locale(lookup("locale", 0, 0));
	srandom(0);
	set_screen_size(SCREEN_WIDTH, SCREEN_HEIGHT);
	layout_screen();
	init_polar();
	init_transforms();
	init_video_in();
	init_display(argc, argv, prog);
	set_category(primary_buttons[Cat_change_color].b);
	gettimeofday(&last_busy, 0);

	ARGBEGIN {
	case 'd':	debug++;			break;
	case 'g':	grabtimeout = atoi(ARGF());	break;
	case 'i':	idletime = atoi(ARGF());	break;
	default:
		return usage();
	} ARGEND;

	if (grabtimeout != 0 && grabtimeout < ALARMTIME) {
		fprintf(stderr, "unreasonable grab time limit\n");
		exit(14);
	}

	state = Live;
	io_main_loop();
	return 0;
}
开发者ID:wcheswick,项目名称:ex,代码行数:35,代码来源:lsc.c


示例2: main

void
main(int argc, char *argv[])
{
	char *p;
	int c;

	thechar = '5';
	thestring = "arm";

	ensuresymb(NSYMB);
	memset(debug, 0, sizeof(debug));
	cinit();
	outfile = 0;
	setinclude(".");
	ARGBEGIN {
	default:
		c = ARGC();
		if(c >= 0 || c < sizeof(debug))
			debug[c] = 1;
		break;

	case 'o':
		outfile = ARGF();
		break;

	case 'D':
		p = ARGF();
		if(p) {
			if (nDlist%8 == 0) 
				Dlist = allocn(Dlist, nDlist*sizeof(char *), 
					8*sizeof(char *));
			Dlist[nDlist++] = p;
		}
		break;

	case 'I':
		p = ARGF();
		setinclude(p);
		break;
	case 't':
		thechar = 't';
		thestring = "thumb";
		break;
	} ARGEND
	if(*argv == 0) {
		print("usage: %ca [-options] file.s\n", thechar);
		errorexit();
	}
	if(argc > 1){
		print("can't assemble multiple files\n");
		errorexit();
	}
	if(assemble(argv[0]))
		errorexit();
	exits(0);
}
开发者ID:hfeeki,项目名称:go,代码行数:56,代码来源:lex.c


示例3: main

void
main(int argc, char **argv)
{
	int stdio;

	stdio = 0;
	ARGBEGIN{
	case 'D':
		++chatty9p;
		break;
	case 'v':
		++chatty;
		break;
	case 'f':
		deffile = ARGF();
		break;
	case 'g':
		gidfile(ARGF());
		break;
	case 'p':
		uidfile(ARGF());
		break;
	case 's':
		stdio = 1;
		break;
	case 'r':
		rdonly = 1;
		break;
	default:
		usage();
	}ARGEND

	if(argc == 0)
		srvfile = "ext2";
	else if(argc == 1)
		srvfile = argv[0];
	else
		usage();
	
	iobuf_init();
	/*notify(handler);*/

	if(!chatty){
		close(2);
		open("#c/cons", OWRITE);
	}
	if(stdio){
		srv(&ext2srv);
	}else{
		chat("%s %d: serving %s\n", argv0, getpid(), srvfile);
		postmountsrv(&ext2srv, srvfile, 0, 0);
	}
	exits(0);
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:54,代码来源:xfssrv.c


示例4: main

void
main(int argc, char *argv[])
{
	Biobuf bout;
	Memimage *i;
	int fd;
	char *err, *filename;
	ImageInfo II;

	ARGBEGIN{
	case 'c':
		II.comment = ARGF();
		if(II.comment == nil)
			usage();
		II.fields_set |= II_COMMENT;
		break;
	case 'g':
		II.gamma = atof(ARGF());
		if(II.gamma == 0.)
			usage();
		II.fields_set |= II_GAMMA;
		break;
	case 't':
		break;
	default:
		usage();
	}ARGEND

	if(Binit(&bout, 1, OWRITE) < 0)
		sysfatal("Binit failed: %r");
	memimageinit();

	if(argc == 0){
		fd = 0;
		filename = "<stdin>";
	}else{
		fd = open(argv[0], OREAD);
		if(fd < 0)
			sysfatal("can't open %s: %r", argv[0]);
		filename = argv[0];
	}

	i = readmemimage(fd);
	if(i == nil)
		sysfatal("can't readimage %s: %r", filename);
	close(fd);

	err = memwritepng(&bout, i, &II);
	freememimage(i);

	if(err != nil)
		fprint(2, "topng: %s\n", err);
	exits(err);
}
开发者ID:aahud,项目名称:harvey,代码行数:54,代码来源:topng.c


示例5: main

void
main(int argc, char*argv[])
{
	char *p;
	Place pl;
	int newbaud;

	newbaud = -1;
	pl = nowhere;
	ARGBEGIN {
	default:
		fprint(2, "usage: %s [-b baud] [-d device] [-l longitude latitude] [-n newbaud]\n", argv0);
		exits("usage");
	case 'D':
		debug++;
		break;
	case 'b':
		baud = strtol(ARGF(), nil, 0);
		break;
	case 'd':
		serial = ARGF();
		break;
	case 'l':
		p = ARGF();
		if(strtolatlon(p, &p, &pl) < 0)
			sysfatal("bad position");
		while(*p == ' ' || *p == '\t' || *p == '\n')
			p++;
		if(*p == '\0')
			p = ARGF();
		if (strtolatlon(p, &p, &pl) < 0)
			sysfatal("bad position");
		while(*p == ' ' || *p == '\t' || *p == '\n')
			p++;
		if(*p != '\0')
			sysfatal("trailing gunk in position");
		where = pl;
		break;
	case 'n':
		newbaud = strtol(ARGF(), nil, 0);
		break;
	} ARGEND

	if(newbaud < 0)
		newbaud = baud;

	fmtinstall('L', placeconv);
	print("Initializing GPS to %d baud, at %L, time %s\n",
		newbaud, where, ctime(time(nil)));
	setline();
	evermore80(where, newbaud);
}
开发者ID:carriercomm,项目名称:plan9-gpl,代码行数:52,代码来源:gpsevermore.c


示例6: main

void
main(int argc, char *av[])
{
	int i;
	char *f;

	argv = av;
	Binit(&bout, 1, OWRITE);
	ARGBEGIN{
	case 'w':
		wordflag = YES;
		break;
	case '_':
		wordflag = YES;
		underscoreflag = YES;
		break;
	case 'm':
		msflag = YES;
		if(f = ARGF())
			switch(*f)
			{
			case 'm':	mac = MM; break;
			case 's':	mac = MS; break;
			case 'l':	disp = 1; break;
			default:	usage();
			}
		else
			usage();
		break;
	case 'i':
		iflag = YES;
		break;
	default:
		usage();
	}ARGEND
	if(*argv)
		infile = opn(*argv++);
	else{
		infile = malloc(sizeof(Biobuf));
		Binit(infile, 0, OREAD);
	}
	files[0] = infile;
	filesp = &files[0];

	for(i='a'; i<='z' ; ++i)
		chars[i] = LETTER;
	for(i='A'; i<='Z'; ++i)
		chars[i] = LETTER;
	for(i='0'; i<='9'; ++i)
		chars[i] = DIGIT;
	chars['\''] = APOS;
	chars['&'] = APOS;
	chars['\b'] = APOS;
	chars['.'] = PUNCT;
	chars[','] = PUNCT;
	chars[';'] = PUNCT;
	chars['?'] = PUNCT;
	chars[':'] = PUNCT;
	work();
}
开发者ID:n-t-roff,项目名称:Plan9_troff,代码行数:60,代码来源:deroff.c


示例7: main

void
main(int argc, char **argv)
{
	int len;
	uchar *cert;
	ulong valid[2];
	RSApriv *key;

	fmtinstall('B', mpfmt);
	fmtinstall('H', encodefmt);

	valid[0] = time(0);
	valid[1] = valid[0] + 3*366*24*60*60;

	ARGBEGIN{
	default:
		usage();
	case 'e':
		valid[1] = valid[0] + strtoul(ARGF(), 0, 10);
		break;
	}ARGEND

	if(argc != 1 && argc != 2)
		usage();

	if((key = getkey(argc-1, argv+1, 1, nil)) == nil)
		sysfatal("%r");

	cert = X509gen(key, argv[0], valid, &len);
	if(cert == nil)
		sysfatal("X509gen: %r");

	write(1, cert, len);
	exits(0);
}
开发者ID:srk-cmu,项目名称:9problems,代码行数:35,代码来源:rsa2x509.c


示例8: xread

static int
xread(int argc, char *argv[]) {
	IxpCFid *fid;
	char *file, *buf;
	int count;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	if(argc == 0)
		usage();
	file = EARGF(usage());
	do {
		fid = ixp_open(client, file, P9_OREAD);
		if(fid == nil)
			fatal("Can't open file '%s': %r\n", file);

		buf = emalloc(fid->iounit);
		while((count = ixp_read(fid, buf, fid->iounit)) > 0)
			write(1, buf, count);
		ixp_close(fid);

		if(count == -1)
			fprint(2, "%s: cannot read file '%s': %r\n", argv0, file);
	} while((file = ARGF()));

	return 0;
}
开发者ID:bartman,项目名称:wmii,代码行数:30,代码来源:wmiir.c


示例9: xawrite

static int
xawrite(int argc, char *argv[]) {
	IxpCFid *fid;
	char *file, *buf;
	int nbuf, i;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	file = EARGF(usage());
	fid = ixp_open(client, file, P9_OWRITE);
	if(fid == nil)
		fatal("Can't open file '%s': %r\n", file);

	nbuf = 1;
	for(i=0; i < argc; i++)
		nbuf += strlen(argv[i]) + (i > 0);
	buf = emalloc(nbuf);
	buf[0] = '\0';
	while(argc) {
		strcat(buf, ARGF());
		if(argc)
			strcat(buf, " ");
	}

	if(ixp_write(fid, buf, nbuf) == -1)
		fatal("cannot write file '%s': %r\n", file);
	ixp_close(fid);
	free(buf);
	return 0;
}
开发者ID:bartman,项目名称:wmii,代码行数:33,代码来源:wmiir.c


示例10: threadmain

void
threadmain(int argc, char *argv[])
{
	uint32_t bcmem;

	bcmem = 0;

	ARGBEGIN{
	case 'B':
		bcmem = unittoull(ARGF());
		break;
	default:
		usage();
		break;
	}ARGEND

	readonly = 1;

	if(argc != 1)
		usage();

	if(initventi(argv[0], &conf) < 0)
		sysfatal("can't init venti: %r");

	if(bcmem < maxblocksize * (mainindex->narenas + mainindex->nsects * 4 + 16))
		bcmem = maxblocksize * (mainindex->narenas + mainindex->nsects * 4 + 16);
	if(0) fprint(2, "initialize %d bytes of disk block cache\n", bcmem);
	initdcache(bcmem);

	clumpstats(mainindex);
	
	threadexitsall(0);
}
开发者ID:aahud,项目名称:harvey,代码行数:33,代码来源:clumpstats.c


示例11: main

void
main(int argc, char **argv)
{
	Ndb *db;
	char *dbfile = 0;

	ARGBEGIN{
	case 'f':
		dbfile = ARGF();
		break;
	default:
		usage();
		break;
	}ARGEND;

	if(argc < 3)
		usage();

	db = ndbopen(dbfile);
	if(db == 0){
		fprint(2, "no db files\n");
		exits("no db");
	}
	search(db, argv[0], argv[1], argv+2, argc-2);
	ndbclose(db);

	exits(0);
}
开发者ID:99years,项目名称:plan9,代码行数:28,代码来源:ipquery.c


示例12: main

int
main(int argc, char *argv[]) {
	char *s;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	setlocale(LC_CTYPE, "");

	initdisplay();

	s = ARGF();
	if(s && !getulong(s, &win.w))
		usage();
	if (!s)
		win.w = getfocus();

	if(argc)
		usage();

	click(&win, Pt(1, 1));

	XCloseDisplay(display);
	return 0;
}
开发者ID:bartman,项目名称:wmii,代码行数:27,代码来源:main.c


示例13: main

void
main(int argc, char *argv[])
{
	Modem *m;

	m = &modems[0];

	ARGBEGIN{
	case 'v':
		vflag = 1;
		break;

	case 's':
		spool = ARGF();
		break;

	default:
		usage();
		break;

	}ARGEND

	initmodem(m, 0, -1, type, 0);
	receivedone(m, faxreceive(m, spool));

	exits(0);
}
开发者ID:aahud,项目名称:harvey,代码行数:27,代码来源:receive.c


示例14: threadmain

void
threadmain(int argc, char *argv[])
{
	u32int bcmem;
	int fix;

	fix = 0;
	bcmem = 0;
	ARGBEGIN{
	case 'B':
		bcmem = unittoull(ARGF());
		break;
	default:
		usage();
		break;
	}ARGEND

	if(!fix)
		readonly = 1;

	if(argc != 1)
		usage();

	if(initventi(argv[0], &conf) < 0)
		sysfatal("can't init venti: %r");

	printindex(1, mainindex);
	threadexitsall(0);
}
开发者ID:npe9,项目名称:harvey,代码行数:29,代码来源:printmap.c


示例15: main

void
main(int argc, char *argv[])
{
	VtSession *z;
	int i, j, t;
	int start;
	uchar buf[BlockSize];

	srand(time(0));

	ARGBEGIN{
	case 'r':
		rflag++;
		break;
	case 'n':
		nblock = atoi(ARGF());
		break;
	}ARGEND

	for(i=0; i<nblock; i++)
		perm[i] = i;

	if(rflag) {
		for(i=0; i<nblock; i++) {
			j = nrand(nblock);
			t = perm[j];
			perm[j] = perm[i];
			perm[i] = t;
		}
	}

	if(readn(0, data, VtScoreSize*nblock) < VtScoreSize*nblock)
		sysfatal("read failed: %r");

	vtAttach();

	z = vtDial("iolaire2");
	if(z == nil)
		sysfatal("cound not connect to venti");
	if(!vtConnect(z, 0))
		vtFatal("vtConnect: %s", vtGetError());

	print("starting\n");

	start = times(0);

	if(rflag && nblock > 10000)
		nblock = 10000;

	for(i=0; i<nblock; i++) {
		if(vtRead(z, data+perm[i]*VtScoreSize, VtDataType, buf, BlockSize) < 0)
			vtFatal("vtRead failed: %d: %s", i, vtGetError());
	}

	print("time = %f\n", (times(0) - start)*0.001);

	vtClose(z);
	vtDetach();
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:59,代码来源:rtest.c


示例16: threadmain

void
threadmain(int argc, char **argv)
{
	NbName from, to;
	char *e = nil;
	int netbios = 0;
	ARGBEGIN {
	case 'u':
		smbglobals.unicode = strtol(ARGF(), 0, 0) != 0;
		break;
	case 'p':
		smbglobals.log.print = 1;
		break;
	case 'd':
		logset(ARGF());
		break;
	case 'w':
		smbglobals.primarydomain = ARGF();
		break;
	case 'n':
		netbios = 1;
		break;
	default:
		usage();
	} ARGEND;
	smbglobalsguess(0);
	smblistencifs(cifsaccept);
	if (netbios) {
		nbinit();
		nbmknamefromstring(from, "*");
		nbmknamefromstring(to, "*smbserver\\x20");
		nbsslisten(to, from, nbssaccept, nil);
		nbmknamefromstringandtype(to, smbglobals.serverinfo.name, 0x20);
		nbsslisten(to, from, nbssaccept, nil);
	}
	smblogprint(-1, "Aquarela %d.%d running\n", smbglobals.serverinfo.vmaj, smbglobals.serverinfo.vmin);
	for (;;) {
		if (netbios&& !smbbrowsesendhostannouncement(smbglobals.serverinfo.name, 60 * 1000,
			SV_TYPE_SERVER,
			smbglobals.serverinfo.remark, &e)) {
			smblogprint(-1, "hostannounce failed: %s\n", e);
		}
		if (sleep(60 * 1000) < 0)
			break;
	}
}
开发者ID:dancrossnyc,项目名称:harvey,代码行数:46,代码来源:aquarela.c


示例17: main

void
main(int argc, char **argv)
{
	int from, to;
	int size = 24;
	int src = Jis;
	char *file = 0;
	long nc, nb;
	int x;
	uchar *bits;
	long *chars;
	int raw = 0;
	Bitmap *b, *b1;
	Subfont *f;
	int *found;

	ARGBEGIN{
	case 'f':	file = ARGF(); break;
	case 'r':	raw = 1; break;
	case '5':	src = Big5; break;
	case 's':	size = 16; break;
	case 'g':	src = Gb_bdf; break;
	case 'q':	src = Gb_qw; break;
	default:	usage();
	}ARGEND
	if(file == 0)
		file = source[src].names[(size==24)? Size24:Size16];
	if(argc != 2)
		usage();
	from = strtol(argv[0], (char **)0, 0);
	to = strtol(argv[1], (char **)0, 0);
	binit(0, 0, "fontgen");
	nc = to-from+1;
	nb = size*size/8;		/* bytes per char */
	nb *= nc;
	bits = (uchar *)malloc(nb);
	chars = (long *)malloc(sizeof(long)*nc);
	found = (int *)malloc(sizeof(found[0])*nc);
	if(bits == 0 || chars == 0){
		fprint(2, "%s: couldn't malloc %d bytes for %d chars\n", argv0, nb, nc);
		exits("out of memory");
	}
	if(raw){
		for(x = from; x <= to; x++)
			chars[x-from] = x;
	} else
		source[src].mfn(from, to, chars);
	memset(bits, 0, nb);
	b = source[src].bfn(file, nc, chars, size, bits, &found);
	b1 = balloc(b->r, b->ldepth);
	bitblt(b1, b1->r.min, b, b->r, S);
	f = bf(nc, size, b1, found);
	wrbitmapfile(1, b);
	wrsubfontfile(1, f);/**/
	exits(0);
}
开发者ID:00001,项目名称:plan9port,代码行数:56,代码来源:main.c


示例18: main

void
main(int argc, char **argv)
{
	int ro;
	char *file, *mount;

	mount = "/n/brzr";
	ro = 0;
	file = "/dev/flash/fs";

	ARGBEGIN {
	case 'D':
		chatty9p++;
		break;
	case 'r':
		ro++;
		break;
	case 'n':
		nsects = argval(ARGF());
		break;
	case 'z':
		sectsize = argval(ARGF());
		break;
	case 'f':
		file = ARGF();
		break;
	case 'm':
		mount = ARGF();
		break;
	default:
		usage();
	} ARGEND

	if(argc != 0)
		usage();

	initdata(file, 0);
	sectbuff = emalloc9p(sectsize);
	einit();
	loadfs(ro);
	serve(mount);
	exits(nil);
}
开发者ID:Requaos,项目名称:harvey,代码行数:43,代码来源:flash.c


示例19: main

void
main(int argc, char	*argv[])
{
	char *ifile, *ofile;

	Cmd = argv[0];
	Hdrtype = 2;

	ARGBEGIN {
	/*
	 * Options without args
	 */
	case 's':
		Strip = 1;
		break;
	/*
	 * Options with args
	 */
	case 'T':
		Txtaddr = strxtol(ARGF());
		break;
	case 'H':
		Hdrtype = strxtol(ARGF());
		break;
	case 'D':
		Debug |= strxtol(ARGF());
		break;
	default:
		Usage("Invalid option");
	} ARGEND

	if (argc != 2)
		Usage("Wrong number of arguments");

	ifile = argv[0];
	ofile = argv[1];

	get_file(ifile);
	put_file(ofile);
	exits(0);
}
开发者ID:pmallappa,项目名称:ken-cc,代码行数:41,代码来源:5cv.c


示例20: main

void
main(int argc, char *argv[])
{
	char *name, buf[4*1024];
	int fd, n, i, errs;

	name = 0;
	ARGBEGIN{
	case 'n':
		name = ARGF();
		break;
	default:
		fprint(2, "usage: kfscmd [-n server] commands\n");
		exits("usage");
	}ARGEND

	if(name)
		snprint(buf, sizeof buf, "/srv/kfs.%s.cmd", name);
	else
		strcpy(buf, "/srv/kfs.cmd");
	fd = open(buf, ORDWR);
	if(fd < 0){
		fprint(2, "kfscmd: can't open commands file\n");
		exits("commands file");
	}

	errs = 0;
	for(i = 0; i < argc; i++){
		if(write(fd, argv[i], strlen(argv[i])) != strlen(argv[i])){
			fprint(2, "%s: error writing %s: %r", argv0, argv[i]);
			errs++;
			continue;
		}
		for(;;){
			n = read(fd, buf, sizeof buf - 1);
			if(n < 0){
				fprint(2, "%s: error executing %s: %r", argv0, argv[i]);
				errs++;
				break;
			}
			buf[n] = '\0';
			if(strcmp(buf, "done") == 0 || strcmp(buf, "success") == 0)
				break;
			if(strcmp(buf, "unknown command") == 0){
				errs++;
				print("kfscmd: command %s not recognized\n", argv[i]);
				break;
			}
			write(1, buf, n);
		}
	}
	exits(errs ? "errors" : 0);		
}
开发者ID:AustenConrad,项目名称:plan-9,代码行数:53,代码来源:kfscmd.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ARGS_ANY函数代码示例发布时间:2022-05-30
下一篇:
C++ ARGB函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap