本文整理汇总了C++中std::ifstream::width方法的典型用法代码示例。如果您正苦于以下问题:C++ ifstream::width方法的具体用法?C++ ifstream::width怎么用?C++ ifstream::width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::ifstream
的用法示例。
在下文中一共展示了ifstream::width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pnm_read
void pnm_read(std::ifstream &file, char *buf)
{
char doc[PNM_BUFFER_SIZE];
char c;
file >> c;
while (c == '#') {
file.getline(doc, PNM_BUFFER_SIZE);
file >> c;
}
file.putback(c);
file.width(PNM_BUFFER_SIZE);
file >> buf;
file.ignore();
}
示例2: readRecord
//.........这里部分代码省略.........
file.read( (char *)&c, sizeof( c ) );
std::cout << (unsigned int)c << " ";
file.read( (char *)&c, sizeof( c ) );
std::cout << (unsigned int)c << " ";
file.read( (char *)&c, sizeof( c ) );
std::cout << (unsigned int)c << " ";
file.read( (char *)&f, sizeof( f ) );
std::cout << f << " ";
file.read( (char *)&f, sizeof( f ) );
std::cout << f << " ";
file.read( (char *)&i, sizeof( i ) );
std::cout << i << " ";
std::cout << std::endl;
std::string name3;
file.getline( temp, 255, 0 );
name3 = temp;
std::cout << "Name3: " << name3 << std::endl;
file.read( (char *)&f, sizeof( f ) );
std::cout << f << std::endl;
#else
readUnknown( file, size );
#endif
}
else if( "FFAM" == group )
{
readUnknown( file, size );
}
else if( "RFAM" == group )
{
readUnknown( file, size );
}
else if( "ADTA" == group )
{
readUnknown( file, size );
}
else if( "PARM" == group )
{
readUnknown( file, size );
}
else if( "SGMT" == group )
{
readUnknown( file, size );
}
else if( "WMAP" == group )
{
readUnknown( file, size );
}
else if( "SMAP" == group )
{
readUnknown( file, size );
}
else if( "XXXX" == group )
{
readUnknown( file, size );
}
else if( "PCNT" == group )
{
if( 4 == size )
{
int data;
file.read( (char*)&data, sizeof( data ) );
std::cout << "Sibling Nodes: " << data << std::endl;
}
else
{
readUnknown( file, size );
}
}
else if( "NODE" == group )
{
std::string name;
file.width( size - 52 );
file >> name;
std::cout << name << std::endl;
std::string r;
file.width( 4 );
file >> r;
std::cout << r << std::endl;
float data;
std::cout << std::fixed;
for( unsigned int i = 0; i < 12; ++i )
{
file.read( (char*)&data, sizeof( data ) );
std::cout << data << " ";
if( ((i+1) % 4) == 0 )
{
std::cout << std::endl;
}
}
std::cout << std::endl;
}