当前位置: 首页>>代码示例>>C++>>正文


C++ istream::get方法代码示例

本文整理汇总了C++中istream::get方法的典型用法代码示例。如果您正苦于以下问题:C++ istream::get方法的具体用法?C++ istream::get怎么用?C++ istream::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在istream的用法示例。


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

示例1: DotD

int DotD(istream &InputFile, char *sCurrent, ostream &OutputFile)
{
	int i = 2;
	int TempChar;

	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'e' && TempChar != 'E')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'f' && TempChar != 'F')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'i' && TempChar != 'I')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'n' && TempChar != 'N')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'e' && TempChar != 'E')
		goto Done;

	OutputFile << "DEFINE";
	return -1;

Done:
	sCurrent[--i] = 0;
	OutputFile << sCurrent;
	return TempChar;
}
开发者ID:bjackson,项目名称:LC3Tools,代码行数:29,代码来源:AsmConvert2to3.cpp

示例2: Load

/*
 *   EXCHANGE
 */
void EXCHANGE_ROW::Load(istream &file)
{
    char buf[1024];
    file.getline(buf, sizeof(buf));
    if (file.eof()) {
        return;
    }
    int rc = sscanf(buf, "%[^\t]\t%[^\t]\t%d\t%d\t%[^\t]%"PRId64,
            EX_ID, EX_NAME, &EX_OPEN, &EX_CLOSE, EX_DESC, &EX_AD_ID);
    if (rc != 6) {
        std::ostringstream strm;
        strm << "EXCHANGE_ROW::Load only loaded " << rc << " values from line";
        throw std::runtime_error(strm.str());
    }
#if 0
    file>>ws;
    file.get(EX_ID, sizeof(EX_ID), '\t');   //read and skip past the next tab
    file>>ws;
    file.get(EX_NAME, sizeof(EX_NAME), '\t');   //read up to the delimiter
    file>>ws;
    file>>EX_OPEN;
    file>>ws;
    file>>EX_CLOSE;
    file>>ws;
    file.get(EX_DESC, sizeof(EX_DESC), '\t');   //read up to the delimiter
    file>>ws;
    file>>EX_AD_ID;
#endif
}
开发者ID:glycerine,项目名称:shore-mt,代码行数:32,代码来源:ReadRowFunctions_sscanf.cpp

示例3: translateStream

void translateStream(istream& inputStream, ostream& outputStream)
{
  int i = 0;
  char ch;
  const int maxLength = 70;
  char word[maxLength] = {""}, translated[maxLength] = {""};
  
  // no word case with eof handler
  while (!isalnum(inputStream.peek())){
    if (inputStream.eof()) return;
    inputStream.get(ch);
    outputStream << ch;
  }

  // word case to obtain words
  while (isalnum(inputStream.peek())){
    inputStream.get(word[i]);
    i++;
  }

  // obtain translation and send to output stream
  translateWord(word,translated);
  outputStream << translated;

  // recusive call
  translateStream(inputStream,outputStream);
}
开发者ID:bingweichen,项目名称:imperial_exams,代码行数:27,代码来源:piglatin.cpp

示例4: SkipComments

bool XFileToken::SkipComments(istream& s)
{
	char c;
	SkipWS(s);
	while (s.get(c))
	{
		if (c == '/')
		{
            if (!s.get(c))
                THROW_EXCEPTION_T("Parsing error", ParsingException);
            if (c != '/')
                THROW_EXCEPTION_T("Parsing error", ParsingException);
		}
		else if (c != '#')
		{
			s.putback(c);
			return true;
		}
		while (s.get(c))
		{
			if (c == '\n')
				break;
		}
		SkipWS(s);
	}
	return false;
}
开发者ID:kamillys,项目名称:IN_SDL_Demo,代码行数:27,代码来源:mini_xfileToken.cpp

示例5: ReadCodes

unsigned char ReadCodes(istream &stream, list<Code> &list)
{
	while (true)
	{
		uint8_t t = stream.get();
		if (t == 0xFF || t == _else || t == endif)
			return t;
		Code code = { };
		code.pointer = (t & 0x80) == 0x80;
		code.type = (CodeType)(t & 0x7F);
		stream.read((char *)&code.address, sizeof(void *));
		if (code.pointer)
		{
			code.offsetcount = stream.get();
			code.offsets = new int[code.offsetcount];
			for (int i = 0; i < code.offsetcount; i++)
				stream.read((char *)&code.offsets[i], sizeof(int32_t));
		}
		stream.read((char *)&code.value, sizeof(uint32_t));
		if (code.type >= ifeq8 && code.type <= ifkbkey)
			switch (ReadCodes(stream, code.trueCodes))
			{
			case _else:
				if (ReadCodes(stream, code.falseCodes) == 0xFF)
					return 0xFF;
				break;
			case 0xFF:
				return 0xFF;
			}
		list.push_back(code);
	}
	return 0;
}
开发者ID:NotKit,项目名称:sg-mod-loader,代码行数:33,代码来源:codes.cpp

示例6: FromStream

void CL_TimeOfDay::FromStream (istream& s)
{
    CL_String rep;
    char c;
    long count = 0;
    char fill_char = s.fill ();
    
    while (s.get (c) && c == fill_char);
    if (!s.good() || s.eof()) {
        _numSecs = 0;
        return;
    }
    do {
        if (isalnum (c) || c == ':') {
            rep.Append (c);
            count++;
        }
        else
            break;
    } while (s.get (c));

    long n = ParseAndConvert (rep);
    if (n > 0) {
        if (!s.eof())
            s.putback (c);
        _numSecs = n;
    }
    else {
        s.seekg (s.tellg() - count, istream::cur);
        _numSecs = 0;
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:32,代码来源:timeofda.cpp

示例7: readQuotedString

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Properties::readQuotedString(istream& in)
{
  char c;

  // Read characters until we see a quote
  while(in.get(c))
  {
    if(c == '"')
      break;
  }

  // Read characters until we see the close quote
  string s;
  while(in.get(c))
  {
    if((c == '\\') && (in.peek() == '"'))
      in.get(c);
    else if((c == '\\') && (in.peek() == '\\'))
      in.get(c);
    else if(c == '"')
      break;
    else if(c == '\r')
      continue;

    s += c;
  }

  return s;
}
开发者ID:CraigularB,项目名称:Provenance,代码行数:30,代码来源:Props.cpp

示例8: parse_scheme

/*
static string parse_scheme( istream &is )
{
    string scheme;
    // Look for ://
    char ch = is.get();

    while( is ) {
        if( ch != ':' )
            scheme += ch;
        else {
            if( is.get() == '/' && is.get() == '/' )
                break;
            else
                throw invalid_argument( "bad URI syntax" );
        }

        ch = is.get();
    }

    return scheme;
}

static string parse_host( istream &is )
{
    string host;
    // until : ? # or /
    char ch = is.get();
    while( is ) {
        if( strchr( ":?#", ch ) ) {
            is.unget();
            break;
        }

        host += ch;
        ch = is.get();
    }
    return host;
}

static string parse_port( istream &is )
{
    string port;

    // until /
    char ch = is.get();

    if( is && ch == ':' ) {
        ch = is.get();
        while( is ) {
            if( strchr( "/?#", ch ) ) {
                is.unget();
                break;
            }
            if( isdigit( ch ))
                port += ch;
            else
                throw invalid_argument( "port must be a number in URI" );
        }
    }

    return port;
}

static string parse_path( istream &is )
{
    string path;

    // until ? og #
    char ch = is.get();

    while( is ) {
        if( strchr( "?#", ch )) {
            is.unget();
            break;
        }

        path += ch;
        ch = is.get();
    }

    return path;
}
*/
static options_t parse_options( istream &is )
{
    list<pair<string,string>> lst;
    char ch = is.get();

    if( is && ch == '?' ) {
        ch = is.get();
        string n, v;
        bool is_v = false;

        while( is ) {
            if( ch == '&' ) {
                lst.push_back( make_pair( n, v ));
                v = n = "";
                is_v = false;
            } else if( ch == '=' )
//.........这里部分代码省略.........
开发者ID:druppy,项目名称:spikes,代码行数:101,代码来源:url.cpp

示例9: if

int
readDataLine(istream &f, strings_t &line, int &expected)
{
  int obtained = 0;
  while (f.good())
    {
      int c = skipBlank(f);
      if (c == '\n' || c == '\r')
        break;
      string s;
      f >> s;
      if (! s.empty())
        {
          line.push_back(s);
          obtained += 1;
        }
    }
  int c = f.get();
  if (c == '\r' && f.get() != '\n')
    f.unget();
  if (obtained > 0)
    {
      if (expected <= 0)
        expected = obtained;
      else if (expected > 0 && expected != obtained)
        {
          cerr << "ERROR: expecting " << expected 
               << " columns in data file." << endl;
          exit(10);
        }
    }
  else
    skipSpace(f);
  return obtained;
}
开发者ID:DavidGrangier,项目名称:svmsparse,代码行数:35,代码来源:crfasgd.cpp

示例10: O

int O(istream &InputFile, char *sCurrent, ostream &OutputFile)
{
	int i = 1;
	int TempChar;

	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'r' && TempChar != 'R')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'i' && TempChar != 'I')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'g' && TempChar != 'G')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'i' && TempChar != 'i')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'n' && TempChar != 'N')
		goto Done;

	sCurrent[i] = 0;
	OutputFile << sCurrent << "_m";
	return -1;

Done:
	sCurrent[--i] = 0;
	OutputFile << sCurrent;
	return TempChar;
}
开发者ID:bjackson,项目名称:LC3Tools,代码行数:30,代码来源:AsmConvert2to3.cpp

示例11: R

int R(istream &InputFile, char *sCurrent, ostream &OutputFile)
{
	int i = 1;
	int TempChar;

	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'e' && TempChar != 'E')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'a' && TempChar != 'A')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'l' && TempChar != 'L')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != '1' && TempChar != '2' && TempChar != '4' && TempChar != '8')
		goto Done;

	sCurrent[i] = 0;
	OutputFile << sCurrent << "_m";
	return -1;

Done:
	sCurrent[--i] = 0;
	OutputFile << sCurrent;
	return TempChar;
}
开发者ID:bjackson,项目名称:LC3Tools,代码行数:27,代码来源:AsmConvert2to3.cpp

示例12: M

int M(istream &InputFile, char *sCurrent, ostream &OutputFile)
{
	int i = 1;
	int TempChar;

	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'a' && TempChar != 'A')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'c' && TempChar != 'C')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'r' && TempChar != 'R')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'o' && TempChar != 'O')
		goto Done;

	sCurrent[i] = 0;
	OutputFile << sCurrent << "_m";
	return -1;

Done:
	sCurrent[--i] = 0;
	OutputFile << sCurrent;
	return TempChar;
}
开发者ID:bjackson,项目名称:LC3Tools,代码行数:27,代码来源:AsmConvert2to3.cpp

示例13: IN

int IN(istream &InputFile, char *sCurrent, ostream &OutputFile)
{
	int i = 2;
	int TempChar;

	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'c' && TempChar != 'C')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'l' && TempChar != 'L')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'u' && TempChar != 'U')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'd' && TempChar != 'D')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'e' && TempChar != 'E')
		goto Done;

	sCurrent[i] = 0;
	OutputFile << sCurrent << "_m";
	return -1;

Done:
	sCurrent[--i] = 0;
	OutputFile << sCurrent;
	return TempChar;
}
开发者ID:bjackson,项目名称:LC3Tools,代码行数:30,代码来源:AsmConvert2to3.cpp

示例14: EX

int EX(istream &InputFile, char *sCurrent, ostream &OutputFile)
{
	int i = 2;
	int TempChar;

	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 't' && TempChar != 'T')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'e' && TempChar != 'E')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'r' && TempChar != 'R')
		goto Done;
	sCurrent[i++] = TempChar = InputFile.get();
	if(TempChar != 'n' && TempChar != 'N')
		goto Done;

	sCurrent[i] = 0;
	OutputFile << sCurrent << "_m";
	return -1;

Done:
	sCurrent[--i] = 0;
	OutputFile << sCurrent;
	return TempChar;
}
开发者ID:bjackson,项目名称:LC3Tools,代码行数:27,代码来源:AsmConvert2to3.cpp

示例15: Load

bool CHotKey::Load(istream& InFile)
#endif
{
	//first read in the name

	//read in the event name
	uint32 nEventNameLen;
	InFile >> nEventNameLen;

	char* pszNameBuffer = new char[nEventNameLen + 1];

	//make sure that we could allocate the memory
	if(pszNameBuffer == NULL)
	{
		return false;
	}

	//skip past the newline
	InFile.get();

	//read in the specified number of characters
	for(uint32 nCurrChar = 0; nCurrChar < nEventNameLen; nCurrChar++)
	{
		pszNameBuffer[nCurrChar] = InFile.get();
	}
	pszNameBuffer[nEventNameLen] = '\0';

	//have the other load set up the name, and load the rest
	bool bRV =  Load(InFile, pszNameBuffer);

	//clean up
	delete [] pszNameBuffer;

	return bRV;
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:35,代码来源:hotkey.cpp


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