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


C++ ifstream::width方法代码示例

本文整理汇总了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();
   }
开发者ID:HWiese1980,项目名称:insight3d,代码行数:16,代码来源:image_io_pnm.cpp

示例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;
    }
开发者ID:Mesagoppinmypants,项目名称:Tools,代码行数:101,代码来源:iffDump.cpp


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