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

C++ readin函数代码示例

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

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



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

示例1: LoadTriangle

void LoadTriangle(){
	switch (model){
	case 0: readin("cube.in");		break;
	case 1: readin("cow_up.in");	break;
	case 2: readin("phone.in");		break;
	default:readin("cube.in");		break;
	}
}
开发者ID:qreety,项目名称:CG_Project2,代码行数:8,代码来源:main.cpp


示例2: main

int main(){
	while(true){
		int m1[100],m2[100];
		int index1,index2;
		if(!readin(m1,&index1))
			break;
		if(!readin(m2,&index2))
			break;		
		qsort(m1,0,index1-1);
		qsort(m2,0,index2-1);
		compare(m1,index1,m2,index2);
	}
	return 0;
}
开发者ID:MdAbuRummanRefat,项目名称:Online-Judge,代码行数:14,代码来源:496+Simply+Subsets+.cpp


示例3: loadbuffer

/*
 * This is equivalent to filevisit from file.c.
 * Look around to see if we can find the file in another buffer; if we
 * can't find it, create a new buffer, read in the text, and switch to
 * the new buffer. *scratch*, *grep*, *compile* needs to be handled 
 * differently from other buffers which have "filenames".
 */
int
loadbuffer(char *bname)
{
	struct buffer *bufp;
	char *adjf;

	/* check for special buffers which begin with '*' */
	if (bname[0] == '*') {
		if ((bufp = bfind(bname, FALSE)) != NULL) {
			curbp = bufp;
			return (showbuffer(bufp, curwp, WFFULL));
		} else {
			return (FALSE);
		}
	} else {	
		if ((adjf = adjustname(bname, TRUE)) == NULL)
			return (FALSE);
		if ((bufp = findbuffer(adjf)) == NULL)
			return (FALSE);
	}
	curbp = bufp;
	if (showbuffer(bufp, curwp, WFFULL) != TRUE)
		return (FALSE);
	if (bufp->b_fname[0] == '\0') {
		if (readin(adjf) != TRUE) {
			killbuffer(bufp);
			return (FALSE);
		}
	}
	return (TRUE);
}
开发者ID:hackalog,项目名称:mg,代码行数:38,代码来源:tags.c


示例4: do_filevisitalt

int
do_filevisitalt(char *fn)
{
	struct buffer	*bp;
	int		 status;
	char		*adjf;

	status = killbuffer(curbp);
	if (status == ABORT || status == FALSE)
		return (ABORT);

	adjf = adjustname(fn, TRUE);
	if (adjf == NULL)
		return (FALSE);
	if (fisdir(adjf) == TRUE)
		return (do_dired(adjf));
	if ((bp = findbuffer(adjf)) == NULL)
		return (FALSE);
	curbp = bp;
	if (showbuffer(bp, curwp, WFFULL) != TRUE)
		return (FALSE);
	if (bp->b_fname[0] == '\0') {
		if ((status = readin(adjf)) != TRUE)
			killbuffer(bp);
		return (status);
	}
	return (TRUE);
}
开发者ID:Scarletts,项目名称:LiteBSD,代码行数:28,代码来源:file.c


示例5: main

int main()
	{
	freopen("1236.in","r",stdin);
	readin();
	solve();
	return 0;
	}
开发者ID:hzhua,项目名称:ojprogram,代码行数:7,代码来源:1236.cpp


示例6: main

int main(int argc, char **argv)
	{
	int i;

#ifdef NEED_ARGV_FIXUP
	argv_fixup( &argc, &argv );
#endif

	flexinit( argc, argv );

	readin();

	ntod();

	for ( i = 1; i <= num_rules; ++i )
		if ( ! rule_useful[i] && i != default_rule )
			line_warning( _( "rule cannot be matched" ),
					rule_linenum[i] );

	if ( spprdflt && ! reject && rule_useful[default_rule] )
		line_warning(
			_( "-s option given but default rule can be matched" ),
			rule_linenum[default_rule] );

	/* Generate the C state transition tables from the DFA. */
	make_tables();

	/* Note, flexend does not return.  It exits with its argument
	 * as status.
	 */
	flexend( 0 );

	return 0;	/* keep compilers/lint happy */
	}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:34,代码来源:main.c


示例7: poptofile

/* ARGSUSED */
int
poptofile(int f, int n)
{
	struct buffer	*bp;
	struct mgwin	*wp;
	char	 fname[NFILEN], *adjf, *bufp;
	int	 status;

	if (getbufcwd(fname, sizeof(fname)) != TRUE)
		fname[0] = '\0';
	if ((bufp = eread("Find file in other window: ", fname, NFILEN,
	    EFNEW | EFCR | EFFILE | EFDEF)) == NULL)
		return (ABORT);
	else if (bufp[0] == '\0')
		return (FALSE);
	adjf = adjustname(fname, TRUE);
	if (adjf == NULL)
		return (FALSE);
	if ((bp = findbuffer(adjf)) == NULL)
		return (FALSE);
	if (bp == curbp)
		return (splitwind(f, n));
	if ((wp = popbuf(bp)) == NULL)
		return (FALSE);
	curbp = bp;
	curwp = wp;
	if (bp->b_fname[0] == '\0') {
		if ((status = readin(adjf)) != TRUE)
			killbuffer(bp);
		return (status);
	}
	return (TRUE);
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:34,代码来源:file.c


示例8: doRun

void TransRecord::doRun()
{
    if (FALSE == readin()) {
        return;
    }
    output();
}
开发者ID:zhoujun06,项目名称:usc_cs570,代码行数:7,代码来源:trans.cpp


示例9: filevisitalt

/* ARGSUSED */
int
filevisitalt(int f, int n)
{
	struct buffer	*bp;
	char	 fname[NFILEN], *bufp, *adjf;
	int	 status;

	if (getbufcwd(fname, sizeof(fname)) != TRUE)
		fname[0] = '\0';
	bufp = eread("Find alternate file: ", fname, NFILEN,
	    EFNEW | EFCR | EFFILE | EFDEF);
	if (bufp == NULL)
		return (ABORT);
	else if (bufp[0] == '\0')
		return (FALSE);

	status = killbuffer(curbp);
	if (status == ABORT || status == FALSE)
		return (ABORT);

	adjf = adjustname(fname, TRUE);
	if (adjf == NULL)
		return (FALSE);
	if ((bp = findbuffer(adjf)) == NULL)
		return (FALSE);
	curbp = bp;
	if (showbuffer(bp, curwp, WFFULL) != TRUE)
		return (FALSE);
	if (bp->b_fname[0] == '\0') {
		if ((status = readin(adjf)) != TRUE)
			killbuffer(bp);
		return (status);
	}
	return (TRUE);
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:36,代码来源:file.c


示例10: main

int
main(int argc, char **argv)
{

	space(0,0,4096,4096);
	init(&xd);
	init(&yd);
	xd.xsize = yd.xsize = 1.;
	xx = (struct val *)malloc((unsigned)sizeof(struct val));
	labsarr = malloc(1);
	labsarr[labsiz++] = 0;
	setopt(argc,argv);
	if(erasf)
		erase();
	readin();
	transpose();
	scale(&xd,(struct val *)&xx->xv);
	scale(&yd,(struct val *)&xx->yv);
	axes();
	title();
	plot();
	move(1,1);
	closevt();
	return(0);
}
开发者ID:andreiw,项目名称:polaris,代码行数:25,代码来源:graph.c


示例11: dofile

/*
 * dofile:
 *	yank a file into a buffer and execute it
 *	if there are no errors, delete the buffer on exit
 *
 * char *fname;		file name to execute
 */
int dofile(char *fname)
{
	struct buffer *bp;	/* buffer to place file to exeute */
	struct buffer *cb;	/* temp to hold current buf while we read */
	int status;	/* results of various calls */
	char bname[NBUFN];	/* name of buffer */

	makename(bname, fname);	/* derive the name of the buffer */
	unqname(bname);		/* make sure we don't stomp things */
	if ((bp = bfind(bname, TRUE, 0)) == NULL)	/* get the needed buffer */
		return FALSE;

	bp->b_mode = MDVIEW;	/* mark the buffer as read only */
	cb = curbp;		/* save the old buffer */
	curbp = bp;		/* make this one current */
	/* and try to read in the file to execute */
	if ((status = readin(fname)) != TRUE) {
		curbp = cb;	/* restore the current buffer */
		return status;
	}

	/* go execute it! */
	curbp = cb;		/* restore the current buffer */
	if ((status = dobuf(bp)) != TRUE)
		return status;

	/* if not displayed, remove the now unneeded buffer and exit */
	if (bp->b_nwnd == 0)
		zotbuf(bp);
	return TRUE;
}
开发者ID:k0gaMSX,项目名称:uemacs,代码行数:38,代码来源:exec.c


示例12: dorevert

int
dorevert(void)
{
	int lineno;
	struct undo_rec *rec;

	if (access(curbp->b_fname, F_OK|R_OK) != 0) {
		dobeep();
		if (errno == ENOENT)
			ewprintf("File %s no longer exists!",
			    curbp->b_fname);
		else
			ewprintf("File %s is no longer readable!",
			    curbp->b_fname);
		return (FALSE);
	}

	/* Save our current line, so we can go back after reloading. */
	lineno = curwp->w_dotline;

	/* Prevent readin from asking if we want to kill the buffer. */
	curbp->b_flag &= ~BFCHG;

	/* Clean up undo memory */
	while ((rec = TAILQ_FIRST(&curbp->b_undo))) {
		TAILQ_REMOVE(&curbp->b_undo, rec, next);
		free_undo_record(rec);
	}

	if (readin(curbp->b_fname))
		return(setlineno(lineno));
	return (FALSE);
}
开发者ID:WizardGed,项目名称:mg,代码行数:33,代码来源:buffer.c


示例13: main

int main(void)
{
	char *p = readin("Dataout");
	fprintf(stderr, "p=%s\n", p);
	if (p != NULL)
		free(p);

}
开发者ID:iloveloveyou,项目名称:chirico,代码行数:8,代码来源:readstdinrealloc.c


示例14: getfile

int getfile(char fname[])
{
  BUFFER *bp;
  LINE *lp;
  char bname[NBUFN];		/* buffer name to put file */
  int i, s;

  for (bp = bheadp; bp != (BUFFER*)0; bp = bp->b_bufp)
    {
      if ((bp->b_flag & BFTEMP) == 0 && strcmp(bp->b_fname, fname) == 0)
	{
	  if (--curbp->b_nwnd == 0)
	    {
	      curbp->b_dotp = curwp->w_dotp;
	      curbp->b_doto = curwp->w_doto;
	      curbp->b_markp = curwp->w_markp;
	      curbp->b_marko = curwp->w_marko;
	    }
	  swbuffer(bp);
	  lp = curwp->w_dotp;
	  i = curwp->w_ntrows / 2;
	  while (i-- && lback(lp) != curbp->b_linep)
	    lp = lback(lp);
	  curwp->w_linep = lp;
	  curwp->w_flag |= WFMODE | WFHARD;
	  mlwrite("[Old buffer]");
	  return (TRUE);
	}
    }
  makename(bname, fname);	/* New buffer name */
  while ((bp = bfind(bname, FALSE, 0)) != (BUFFER*)0)
    {
      s = mlreply("Buffer name: ", bname, NBUFN);
      if (s == ABORT)		/* ^G to just quit */
	return (s);
      if (s == FALSE)
	{			/* CR to clobber it */
	  makename(bname, fname);
	  break;
	}
    }
  if (bp == (BUFFER*)0 && (bp = bfind(bname, TRUE, 0)) == (BUFFER*)0)
    {
      mlwrite("Cannot create buffer");
      return (FALSE);
    }
  if (--curbp->b_nwnd == 0)
    {				/* Undisplay */
      curbp->b_dotp = curwp->w_dotp;
      curbp->b_doto = curwp->w_doto;
      curbp->b_markp = curwp->w_markp;
      curbp->b_marko = curwp->w_marko;
    }
  curbp = bp;			/* Switch to it */
  curwp->w_bufp = bp;
  curbp->b_nwnd++;
  return (readin(fname));	/* Read it in */
}
开发者ID:jdstroy,项目名称:retrobsd,代码行数:58,代码来源:file.c


示例15: flex_main

int flex_main (int argc, char *argv[])
{
	int     i, exit_status, child_status;

	/* Set a longjmp target. Yes, I know it's a hack, but it gets worse: The
	 * return value of setjmp, if non-zero, is the desired exit code PLUS ONE.
	 * For example, if you want 'main' to return with code '2', then call
	 * longjmp() with an argument of 3. This is because it is invalid to
	 * specify a value of 0 to longjmp. FLEX_EXIT(n) should be used instead of
	 * exit(n);
	 */
	exit_status = setjmp (flex_main_jmp_buf);
	if (exit_status){
        if (stdout && !_stdout_closed && !ferror(stdout)){
            fflush(stdout);
            fclose(stdout);
        }
        while (wait(&child_status) > 0){
            if (!WIFEXITED (child_status)
                || WEXITSTATUS (child_status) != 0){
                /* report an error of a child
                 */
                if( exit_status <= 1 )
                    exit_status = 2;

            }
        }
        return exit_status - 1;
    }

	flexinit (argc, argv);

	readin ();

	skelout ();
	/* %% [1.5] DFA */
	ntod ();

	for (i = 1; i <= num_rules; ++i)
		if (!rule_useful[i] && i != default_rule)
			line_warning (_("rule cannot be matched"),
				      rule_linenum[i]);

	if (spprdflt && !reject && rule_useful[default_rule])
		line_warning (_
			      ("-s option given but default rule can be matched"),
			      rule_linenum[default_rule]);

	/* Generate the C state transition tables from the DFA. */
	make_tables ();

	/* Note, flexend does not return.  It exits with its argument
	 * as status.
	 */
	flexend (0);

	return 0;		/* keep compilers/lint happy */
}
开发者ID:alagoutte,项目名称:flex,代码行数:58,代码来源:main.c


示例16: fileread

/*
 * Read a file into the current buffer. This is really easy; all you do it
 * find the name of the file, and call the standard "read a file into the
 * current buffer" code. Bound to "C-X C-R"
 */
int fileread(int f, int n)
{
  int s;
  char fname[NFILEN];

  if ((s = mlreply("Read file: ", fname, NFILEN)) != TRUE)
    return (s);
  return (readin(fname));
}
开发者ID:jdstroy,项目名称:retrobsd,代码行数:14,代码来源:file.c


示例17: main

int main(){
	
	int c=1;
	int i,m1,m2;
	while(scanf("%d%d",&m1,&m2)==2){
		if(m1==-1&&m2==-1)
			break;

		memset(&count,0,sizeof(count));
		memset(&connect,false,sizeof(connect));
		ptr=0;

		if(m1==0&&m2==0)
			printf("Case %d is a tree.\n",c++);
		else{
			readin(m1,m2);
			while(true){
				scanf("%d%d",&m1,&m2);
				if(m1==0&&m2==0)
					break;
				readin(m1,m2);
			}
			
			int zero_count=0,pos;
			for(i=0;i<ptr;i++)
				if(count[i]==0)
					zero_count++,pos=i;
				else if(count[i]>1)
					break;
			if(zero_count==1&&i>=ptr){
				int t=0;
				travel(pos,&t);
				if(t==ptr)
					printf("Case %d is a tree.\n",c++);
				else
					printf("Case %d is not a tree.\n",c++);
			}
			else
				printf("Case %d is not a tree.\n",c++);
		}
	}
	return 0;
}
开发者ID:MdAbuRummanRefat,项目名称:Online-Judge,代码行数:43,代码来源:615+Is+It+A+Tree.cpp


示例18: doRun

void Disp::doRun()
{
    if(FALSE == readin()) {
        cerr << "readin failed.\n";
        return;
    } else {
        uint64_t bits = 0;
        output(bits);
    }
}
开发者ID:zhoujun06,项目名称:usc_cs570,代码行数:10,代码来源:disp.cpp


示例19: fileread

/*
 * Read a file into the current
 * buffer. This is really easy; all you do it
 * find the name of the file, and call the standard
 * "read a file into the current buffer" code.
 * Bound to "C-X C-R".
 */
int fileread(int f, int n)
{
	int s;
	char fname[NFILEN];

	if (restflag)		/* don't allow this command if restricted */
		return resterr();
	if ((s = mlreply("Read file: ", fname, NFILEN)) != TRUE)
		return s;
	return readin(fname, TRUE);
}
开发者ID:ChunHungLiu,项目名称:uemacs,代码行数:18,代码来源:file.c


示例20: getfile

/*
 * getfile()
 *
 * char fname[];	file name to find
 * int lockfl;		check the file for locks?
 */
int getfile(char *fname, int lockfl)
{
	struct buffer *bp;
	struct line *lp;
	int i;
	int s;
	char bname[NBUFN];	/* buffer name to put file */

#if	MSDOS
	mklower(fname);		/* msdos isn't case sensitive */
#endif
	for (bp = bheadp; bp != NULL; bp = bp->b_bufp) {
		if ((bp->b_flag & BFINVS) == 0
		    && strcmp(bp->b_fname, fname) == 0) {
			swbuffer(bp);
			lp = curwp->w_dotp;
			i = curwp->w_ntrows / 2;
			while (i-- && lback(lp) != curbp->b_linep)
				lp = lback(lp);
			curwp->w_linep = lp;
			curwp->w_flag |= WFMODE | WFHARD;
			cknewwindow();
			mlwrite("(Old buffer)");
			return TRUE;
		}
	}
	makename(bname, fname);	/* New buffer name.     */
	while ((bp = bfind(bname, FALSE, 0)) != NULL) {
		/* old buffer name conflict code */
		s = mlreply("Buffer name: ", bname, NBUFN);
		if (s == ABORT)	/* ^G to just quit      */
			return s;
		if (s == FALSE) {	/* CR to clobber it     */
			makename(bname, fname);
			break;
		}
	}
	if (bp == NULL && (bp = bfind(bname, TRUE, 0)) == NULL) {
		mlwrite("Cannot create buffer");
		return FALSE;
	}
	if (--curbp->b_nwnd == 0) {	/* Undisplay.           */
		curbp->b_dotp = curwp->w_dotp;
		curbp->b_doto = curwp->w_doto;
		curbp->b_markp = curwp->w_markp;
		curbp->b_marko = curwp->w_marko;
	}
	curbp = bp;		/* Switch to it.        */
	curwp->w_bufp = bp;
	curbp->b_nwnd++;
	s = readin(fname, lockfl);	/* Read it in.          */
	cknewwindow();
	return s;
}
开发者ID:arturocastro,项目名称:uemacs,代码行数:60,代码来源:file.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ readinputportbytag函数代码示例发布时间:2022-05-30
下一篇:
C++ readi函数代码示例发布时间: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