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

C++ eof函数代码示例

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

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



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

示例1: while

std::string
mm_io_c::getline() {
  char c;
  std::string s;

  if (eof())
    throw mtx::mm_io::end_of_file_x{mtx::mm_io::make_error_code()};

  while (read(&c, 1) == 1) {
    if (c == '\r')
      continue;
    if (c == '\n')
      return s;
    s += c;
  }

  return s;
}
开发者ID:VRDate,项目名称:mkvtoolnix,代码行数:18,代码来源:mm_io.cpp


示例2: while

   const char *RTextFile::GetNextStrToken(std::string &str) {
      char *set = "\r\t\n ";
      char *strstart;
      str="";

      // Strip la classe blank avant le nouveau token;
      while (_curpos < _buff+_size && (*_curpos == '\r' || *_curpos == '\n' || *_curpos == ' ' || *_curpos == '\t'))
         _curpos++;
      strstart = _curpos;
      
      if (!eof()) {
         int next = mystrcmp(_curpos,set,_buff+_size);
         str.assign(_curpos,_curpos+next);
         _curpos = _curpos+next;
      }

      return str.c_str();
   }
开发者ID:CortlandNation9,项目名称:Gamecodeur,代码行数:18,代码来源:ESceneParser.cpp


示例3: first

bool Dataset::locate(){
  bool result;
  if (plist.empty()) return false;

  std::map<std::string, field_value>::const_iterator i;
  first();
  while (!eof()) {
    result = true;
    for (i=plist.begin();i!=plist.end();++i)
      if (fv(i->first.c_str()).get_asString() == i->second.get_asString()) {
	continue;
      }
      else {result = false; break;}
    if (result) { return result;}
    next();
  }
  return false;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:18,代码来源:dataset.cpp


示例4: while

const char *XMLParser::seekNextTag(const char *m[], const char *d[]){
   doublebuffer->clear();
   boolean f = true;

   while (f && !eof()){
      doublebuffer->add(seekNextTag());

      size_t pos1  = pos;
      const char *s  = getNextTag();
      const char *ds = NULL;
      size_t i;

      for(i = 0; d[i]; i++)
         if (cmpTag(s, d[i]) > 0){
            ds=extractDoubleTag(d[i], true);
            break;
         }

      const char *cs=d[i];

      for(i = 0; m[i]; i++)
         if (cmpTag(s, m[i]) > 0){
            f = false;
            break;
         }

      if (f){
         if (!isempty(s)){
            doublebuffer->add(OPENTAG);
            doublebuffer->add(s);
            doublebuffer->add(CLOSETAG);
	 }
	 if (!isempty(ds)){
	    doublebuffer->add(ds);
            doublebuffer->add(OPENTAG);
            doublebuffer->add(OFFTAG);
            doublebuffer->add(cs);
            doublebuffer->add(CLOSETAG);
         }
      }else
      	 pos=pos1;
   }
   return doublebuffer->get();
};
开发者ID:nmmmnu,项目名称:ccc,代码行数:44,代码来源:xml_parser.cpp


示例5: nextToken

void UnwrappedLineParser::parseEnum() {
  nextToken();
  if (FormatTok->Tok.is(tok::identifier) ||
      FormatTok->Tok.is(tok::kw___attribute) ||
      FormatTok->Tok.is(tok::kw___declspec)) {
    nextToken();
    // We can have macros or attributes in between 'enum' and the enum name.
    if (FormatTok->Tok.is(tok::l_paren)) {
      parseParens();
    }
    if (FormatTok->Tok.is(tok::identifier))
      nextToken();
  }
  if (FormatTok->Tok.is(tok::l_brace)) {
    if (Style.BreakBeforeBraces == FormatStyle::BS_Allman)
      addUnwrappedLine();
    nextToken();
    addUnwrappedLine();
    ++Line->Level;
    do {
      switch (FormatTok->Tok.getKind()) {
      case tok::l_paren:
        parseParens();
        break;
      case tok::r_brace:
        addUnwrappedLine();
        nextToken();
        --Line->Level;
        return;
      case tok::comma:
        nextToken();
        addUnwrappedLine();
        break;
      default:
        nextToken();
        break;
      }
    } while (!eof());
  }
  // We fall through to parsing a structural element afterwards, so that in
  // enum A {} n, m;
  // "} n, m;" will end up in one unwrapped line.
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_clang,代码行数:43,代码来源:UnwrappedLineParser.cpp


示例6: get_page_for_next_record

static page_p get_page_for_next_record ( schema_p s )
{
  page_p pg = s->tbl->current_pg;
  if (eof(pg)) return NULL;
  if (eob(pg))
    {
      unpin (pg);
      pg = get_next_page (pg);
      if ( pg == NULL)
	{
	  put_msg (FATAL, "get_page_for_next_record failed at block %d\n",
		   page_block_nr(pg) + 1);
	  exit (EXIT_FAILURE);
	}
      page_set_pos_begin (pg);
      s->tbl->current_pg = pg;
    }
  return pg;
}
开发者ID:tho068,项目名称:database-2,代码行数:19,代码来源:schema.c


示例7: nextToken

bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
  nextToken();
  if (FormatTok->is(tok::equal)) {
    nextToken();
    if (FormatTok->is(tok::r_square)) {
      nextToken();
      return true;
    }
    if (FormatTok->isNot(tok::comma))
      return false;
    nextToken();
  } else if (FormatTok->is(tok::amp)) {
    nextToken();
    if (FormatTok->is(tok::r_square)) {
      nextToken();
      return true;
    }
    if (!FormatTok->isOneOf(tok::comma, tok::identifier)) {
      return false;
    }
    if (FormatTok->is(tok::comma))
      nextToken();
  } else if (FormatTok->is(tok::r_square)) {
    nextToken();
    return true;
  }
  do {
    if (FormatTok->is(tok::amp))
      nextToken();
    if (!FormatTok->isOneOf(tok::identifier, tok::kw_this))
      return false;
    nextToken();
    if (FormatTok->is(tok::comma)) {
      nextToken();
    } else if (FormatTok->is(tok::r_square)) {
      nextToken();
      return true;
    } else {
      return false;
    }
  } while (!eof());
  return false;
}
开发者ID:ADonut,项目名称:LLVM-GPGPU,代码行数:43,代码来源:UnwrappedLineParser.cpp


示例8: raise_notice

String File::read(int64 length) {
  if (length <= 0) {
    raise_notice("Invalid length %lld", length);
    return "";
  }

  String s = String(length, ReserveString);
  char *ret = s.mutableSlice().ptr;
  int64 copied = 0;
  int64 avail = m_writepos - m_readpos;

  while (avail < length && !eof()) {
    if (m_buffer == NULL) {
      m_buffer = (char *)malloc(CHUNK_SIZE);
    }

    if (avail > 0) {
      memcpy(ret + copied, m_buffer + m_readpos, avail);
      copied += avail;
      length -= avail;
    }

    m_writepos = readImpl(m_buffer, CHUNK_SIZE);
    m_readpos = 0;
    avail = m_writepos - m_readpos;

    if (avail == 0 || m_nonblocking) {
      // For nonblocking mode, temporary out of data.
      break;
    }
  }

  avail = m_writepos - m_readpos;
  if (avail > 0) {
    int64 n = length < avail ? length : avail;
    memcpy(ret + copied, m_buffer + m_readpos, n);
    m_readpos += n;
    copied += n;
  }

  m_position += copied;
  return s.setSize(copied);
}
开发者ID:deivisonarthur,项目名称:hiphop-php,代码行数:43,代码来源:file.cpp


示例9: readFileChunk

bool BufferedStreamMgr::readFileChunk()
{
	if (eof()) {
		return false;
	}
	memset(_mainBuf, 0, _useBufSize +1);
	_mainBufCurrStartPos = 0;

	if (!_streamFinished) {
		_mainBufCurrLen = _inputStreamMgr->read((char *)_mainBuf, _useBufSize);
		if (_mainBufCurrLen < _useBufSize) {
			_streamFinished = true;
		}
		return _mainBufCurrLen > 0;
	} else {
		_mainBufCurrLen = 0;
		return false;
	}
}
开发者ID:Annaerial,项目名称:bedtools2,代码行数:19,代码来源:BufferedStreamMgr.cpp


示例10: initmsg

initmsg()
{
char s[80],k[80];
int i;

numread=0;
i=curconf;
i++;
strcpy(s,config.supportdir);
itoa(i,k,10);
strcat(s,k);
strcat(s,"MSG.IDX");
i=0;

filefile=open(s,O_RDWR | O_BINARY);

if(filefile!=-1 && (filelength(filefile)!=0))
	{
	while(!eof(filefile))
		{
		read(filefile,&bidx[i],sizeof(struct boardindex));
		i++;
		numread++;
		}
	close(filefile);
	return;
	}


filefile=open(s,O_BINARY | O_RDWR | O_CREAT,S_IWRITE | S_IREAD);
strcpy(bidx[0].name,"General");
bidx[0].num=1;
bidx[0].level=10;
bidx[0].maxmsgs=255;
bidx[0].net=0;
bidx[0].totalmsgs=0;
bidx[0].options=0;
bidx[0].pass[0]=0;
write(filefile,&bidx[0],sizeof(struct boardindex));
close(filefile);
numread=1;
}
开发者ID:mdiiorio,项目名称:ForceTen,代码行数:42,代码来源:MSG.C


示例11: fill_cache

std::streamsize
NoSeekFile::read(void *dst, std::streamsize bytes)
{
#ifdef GNASH_NOSEEK_FD_VERBOSE
    std::cerr << boost::format("read_cache(%d) called") % bytes << std::endl;
#endif

    if (eof()) {
#ifdef GNASH_NOSEEK_FD_VERBOSE
        std::cerr << "read_cache: at eof!" << std::endl;
#endif
        return 0;
    }

    fill_cache(bytes + tell());

#ifdef GNASH_NOSEEK_FD_VERBOSE
    printInfo();
#endif

    std::streamsize ret = std::fread(dst, 1, bytes, _cache);

    if (ret == 0) {
        if (std::ferror(_cache)) {
            std::cerr << "an error occurred while reading from cache" <<
                std::endl;
        }
#if GNASH_NOSEEK_FD_VERBOSE
        if (std::feof(_cache)) {
            std::cerr << "EOF reached while reading from cache" << std::endl;
        }
#endif
    }

#ifdef GNASH_NOSEEK_FD_VERBOSE
    std::cerr << boost::format("fread from _cache returned %d") % ret <<
        std::endl;
#endif

    return ret;

}
开发者ID:BrandRegard,项目名称:gnash,代码行数:42,代码来源:noseek_fd_adapter.cpp


示例12: while

bool istream::readtags(string& s, const string& tag)
{
	char buf[8192];

	s.clear();

	while (!eof())
	{
		size_t size = sizeof(buf);
		if (readtags(buf, &size, tag.c_str(), tag.length()) == true)
		{
			if (size > 0)
				s.append(buf, size);
			return true;
		}
		if (size > 0)
			s.append(buf, size);
	}
	return false;
}
开发者ID:FlowSea,项目名称:acl,代码行数:20,代码来源:istream.cpp


示例13: while

Token Lexer::Next()
{
	char curr_c;
	TType a_type;
	while (!eof())
	{
		curr_c = read();
		state = SwitchState(curr_c, state, a_type);
		if (state == accept)
		{
			Token Tok = Accept(a_type);
			if (a_type == Skip)
				continue;

			return Tok;
		}
	}
	if (state == ready)
		return Token(Eof, "");
}
开发者ID:AhmedHossamFadl,项目名称:Interpreter,代码行数:20,代码来源:Lexer.cpp


示例14: parseString

/**
Parse a source string as an expression
*/
Tuple parseString(const char* str, const char* srcName)
{
    auto input = new Input(
        str,
        srcName
    );

    input->eatWS();

    auto expr = parseExpr(input);

    input->eatWS();

    if (!input->eof())
    {
        throw ParseError(input, "unconsumed input remains");
    }

    return expr;
}
开发者ID:maximecb,项目名称:bjrn,代码行数:23,代码来源:parser.cpp


示例15: advance

 bool IntervalBtreeCursor::advance() {
     RARELY killCurrentOp.checkForInterrupt();
     if ( eof() ) {
         return false;
     }
     // Advance _curr to the next key in the btree.
     _curr.bucket = _curr.bucket.btree<V1>()->advance( _curr.bucket,
                                                       _curr.pos,
                                                       1,
                                                       __FUNCTION__ );
     skipUnused( &_curr );
     if ( _curr == _end ) {
         // _curr has reached _end, so iteration is complete.
         _curr.bucket.Null();
     }
     else {
         ++_nscanned;
     }
     return ok();
 }
开发者ID:Cassie90,项目名称:mongo,代码行数:20,代码来源:intervalbtreecursor.cpp


示例16: while

char *MemFile::fgets(char *s, int size) const
{
    int n = 0;
    while (n < size - 1 && !eof())
    {
        char c;
        size_t sz = fread(&c, 1, 1);
        if (sz)
        {
            if (c == 10)
            {
                s[n] = 0;
                return s;
            }
            s[n++] = c;
        }
    }
    s[n] = 0;
    return s;
}
开发者ID:konanrobot,项目名称:CppLanguagePrograms,代码行数:20,代码来源:File.cpp


示例17: readBit

int BitInputStream::readBit()
{
    if (bufi==8)
    {
        if(eof())
            return -1;
        buf=in.get();
        bufi=0;
    }
    bufi++;
    int i = buf>>7;
    buf=buf<<1;
#define test4
#ifndef test4
#define test4
    cout<<i<<endl;
#endif
    return i;
    
}
开发者ID:hongmincschen,项目名称:HuffmanCompressing,代码行数:20,代码来源:BitInputStream.cpp


示例18: main

main()
{
printf("\n   ENTER NAME : ");
startname[0] = 20;
startname[1] = 8;
readstring(&startname[2]);
printf("\n   ENTER SERIAL NO. : ");
readstring(serial);

for (i = strlen(startname);i < 30;i++)
startname[i] = ' ';
sprintf(&startname[30],"SERIAL No.    %s%c",serial,0);

pirated();
printf("\nSearching.....");
fhandle = open("options.exe",NORM);
lseek(fhandle,1,SEEK_SET);

do
{
lastseek = read(fhandle,&buffer,BUFLEN);
string1 = find(_osmajor * _osminor - ALPHA + 'C',buffer,&buffer[BUFLEN],checkdisktype()- GAMMA + 5);
if (string1 != NULL)
	{
	printf("\nsuccessful 1\n");
	sprintf(string1,"%s",startname);
	string1 = find(_osminor / _osmajor - BETA + 'A',buffer,&buffer[BUFLEN],checkdisktype()- GAMMA + 5);
	if (string1 != NULL)
		{
		printf("successful 2\n");
		sprintf(string1,"%s",codesname);
		lseek(fhandle,-lastseek,SEEK_CUR);
		write(fhandle,&buffer,BUFLEN);
		printf("\nSuccessfully Installed for :\n%s",startname);
		exit(0);
		}
	}
} while (string1 == NULL && !eof(fhandle));
printf("Un-Successful\n");
close(fhandle);
}
开发者ID:tridge,项目名称:junkcode,代码行数:41,代码来源:prods2.c


示例19: while

void netlist_parser::skipws()
{
	while (unsigned char c = getc())
	{
		switch (c)
		{
		case ' ':
		case 9:
		case 10:
		case 13:
			break;
		case '#':
		    skipeol(); // treat preprocessor defines as comments
		    break;
		case '/':
			c = getc();
			if (c == '/')
			{
				skipeol();
			}
			else if (c == '*')
			{
				int f=0;
				while (!eof() )
				{
				    c = getc();
					if (f == 0 && c == '*')
						f=1;
					else if (f == 1 && c== '/' )
						break;
					else
						f=0;
				}
			}
			break;
		default:
			ungetc();
			return;
		}
	}
}
开发者ID:felipesanches,项目名称:ume,代码行数:41,代码来源:nl_parser.c


示例20: readID

int readID(int file)
{
    char id[5];
    id[4]=0;
    BYTE a;

    for(a=0; a<4; a++)
        id[a]=readChar(file);
    if(eof(file))
    {
        printf("End of file reached.");
        return ID_EOF;
    }
    if(rb->strcmp(id, "MThd")==0)
        return ID_MTHD;
    if(rb->strcmp(id, "MTrk")==0)
        return ID_MTRK;
    if(rb->strcmp(id, "RIFF")==0)
        return ID_RIFF;
    return ID_UNKNOWN;
}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:21,代码来源:midifile.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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