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


C++ OStream::tellp方法代码示例

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


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

示例1: makeTiled

Int64
Header::writeTo (OStream &os, bool isTiled) const
{
    //
    // Write a "magic number" to identify the file as an image file.
    // Write the current file format version number.
    //

    Xdr::write <StreamIO> (os, MAGIC);

    int version = isTiled ? makeTiled (EXR_VERSION) : EXR_VERSION;
    Xdr::write <StreamIO> (os, version);

    //
    // Write all attributes.  If we have a preview image attribute,
    // keep track of its position in the file.
    //

    Int64 previewPosition = 0;

    const Attribute *preview =
        findTypedAttribute <PreviewImageAttribute> ("preview");

    for (ConstIterator i = begin(); i != end(); ++i)
    {
        //
        // Write the attribute's name and type.
        //

        Xdr::write <StreamIO> (os, i.name());
        Xdr::write <StreamIO> (os, i.attribute().typeName());

        //
        // Write the size of the attribute value,
        // and the value itself.
        //

        StdOSStream oss;
        i.attribute().writeValueTo (oss, version);

        std::string s = oss.str();
        Xdr::write <StreamIO> (os, (int) s.length());

        if (&i.attribute() == preview)
            previewPosition = os.tellp();

        os.write (s.data(), s.length());
    }

    //
    // Write zero-length attribute name to mark the end of the header.
    //

    Xdr::write <StreamIO> (os, "");

    return previewPosition;
}
开发者ID:gorkinovich,项目名称:DefendersOfMankind,代码行数:57,代码来源:ImfHeader.cpp

示例2: position

Int64
TileOffsets::writeTo (OStream &os) const
{
    //
    // Write the tile offset table to the file, and
    // return the position of the start of the table
    // in the file.
    //
    
    Int64 pos = os.tellp();

    if (pos == -1)
	Iex::throwErrnoExc ("Cannot determine current file position (%T).");

    for (unsigned int l = 0; l < _offsets.size(); ++l)
	for (unsigned int dy = 0; dy < _offsets[l].size(); ++dy)
	    for (unsigned int dx = 0; dx < _offsets[l][dy].size(); ++dx)
		Xdr::write <StreamIO> (os, _offsets[l][dy][dx]);

    return pos;
}
开发者ID:A7med-Shoukry,项目名称:g3d,代码行数:21,代码来源:ImfTileOffsets.cpp


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