本文整理汇总了C++中std::fstream::peek方法的典型用法代码示例。如果您正苦于以下问题:C++ fstream::peek方法的具体用法?C++ fstream::peek怎么用?C++ fstream::peek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::fstream
的用法示例。
在下文中一共展示了fstream::peek方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseShotTypeList
std::set<wxString> parseShotTypeList(std::fstream &mfilestream)
{
char c;
std::set<wxString> types;
std::string shottypename;
c = getnextnonwhite(mfilestream);
if(c!='{') throw parseerror::missing_opening_bracket;
while(whitespace(mfilestream.peek()))
{
c=mfilestream.get();
}
if(mfilestream.peek() == '}')
{
mfilestream.get();
return types;
}
while(c!='}')
{
shottypename = extractQuotedPrefix(mfilestream);
types.insert(shottypename);
c = getnextnonwhite(mfilestream);
if(c!=',' && c!='}') throw parseerror::missing_comma;
}
return types;
}
示例2: while
//------------------------------------------------------------------------------
/// \brief reads comments
//------------------------------------------------------------------------------
void ProcessorMNW2::impl::ReadComments (std::fstream& a_is,
std::fstream& a_os)
{
char c = (char)a_is.peek();
while (c == '#')
{
std::string line;
std::getline(a_is, line);
// write all the comments back to the file except for #GMS_HDF5_01
if ("#GMS_HDF5_01" != line)
{
a_os << line << "\n";
}
c = (char)a_is.peek();
}
} // ProcessorMNW2::impl::ReadComments
示例3: extractNumber
std::string extractNumber(std::fstream &mfilestream)
{
char c;
std::string entry;
do
{
mfilestream.get(c);
entry+=c;
c = mfilestream.peek();
}
while (c!=','&&c!='}'&&c!=')');
return entry;
}
示例4: parseVC
void parseVC( std::fstream &file, std::string array_name, unsigned long int **array, char *chars,
const unsigned int s, const unsigned long int P, const char skip=1 ) {
std::string line;
unsigned long int uli;
std::cout << "Will read " << array_name << std::endl;
if( skip )
file.getline( chars, 500 ); //go past EOL
if( file.peek() != '%' ) {
std::cout << "Not at header line!" << std::endl;
file >> line;
std::cout << line << std::endl;
file >> line;
std::cout << line << std::endl;
exit( 1 );
}
示例5: Peek
char Scanner::Peek()
{
return file_.peek();
}