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


C++ Tell函数代码示例

本文整理汇总了C++中Tell函数的典型用法代码示例。如果您正苦于以下问题:C++ Tell函数的具体用法?C++ Tell怎么用?C++ Tell使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Len

	SQInteger Len() {
		SQInteger prevpos=Tell();
		Seek(0,SQ_SEEK_END);
		SQInteger size=Tell();
		Seek(prevpos,SQ_SEEK_SET);
		return size;
	}
开发者ID:Hiroyuki-Nagata,项目名称:mona,代码行数:7,代码来源:sqstdio.cpp

示例2: Tell

// Determines the length of the stream.
void StreamFile::GetLength()
{
	size_t current_position = Tell();
	Seek(0, SEEK_END);
	length = Tell();
	Seek(current_position, SEEK_SET);
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:8,代码来源:StreamFile.cpp

示例3: ASSERT

long cFile::GetSize(void) const
{
	ASSERT(IsOpen());

	if (!IsOpen())
	{
		return -1;
	}

	long CurPos = Tell();
	if (CurPos < 0)
	{
		return -1;
	}
	if (fseek(m_File, 0, SEEK_END) != 0)
	{
		return -1;
	}
	long res = Tell();
	if (fseek(m_File, static_cast<long>(CurPos), SEEK_SET) != 0)
	{
		return -1;
	}
	return res;
}
开发者ID:1285done,项目名称:cuberite,代码行数:25,代码来源:File.cpp

示例4: switch

int     FILEFile::Seek(int offset, int origin)
{
    int newOrigin = 0;
    switch(origin)
    {
    case Seek_Set: newOrigin = SEEK_SET; break;
    case Seek_Cur: newOrigin = SEEK_CUR; break;
    case Seek_End: newOrigin = SEEK_END; break;
    }

    if (newOrigin == SEEK_SET && offset == Tell())
        return Tell();

    if (fseek (fs, offset, newOrigin))
    {
#ifdef OVR_FILE_VERIFY_SEEK_ERRORS
        OVR_ASSERT(0);
#endif
        return -1;
    }
    
#ifdef OVR_FILE_VERIFY_SEEK_ERRORS
    // Track file position after seeks for read verification later.
    switch(origin)
    {
    case Seek_Set:  TestPos = offset;       break;
    case Seek_Cur:  TestPos += offset;      break;    
    case Seek_End:  TestPos = FileTestLength + offset; break;
    }
    OVR_ASSERT((int)TestPos == Tell());
#endif

    return (int)Tell();
}
开发者ID:CLOUDS-Interactive-Documentary,项目名称:ofxOculusRift,代码行数:34,代码来源:OVR_FileFILE.cpp

示例5: ClampedTell

  float ClampedTell ()
  {
    float offset = Tell ().cast<float> ();

    if (looped) return fmod (offset, duration);
    else        return offset < duration ? Tell ().cast<float> () : duration;
  }  
开发者ID:untgames,项目名称:funner,代码行数:7,代码来源:sg_animation_controller.cpp

示例6: MI_ERROR

mEResult mCFileStream::Read( mCString & a_strDest )
{
    // Note: m_arrBuffer (a mCCharArray) is guaranteed to be 0-terminated.
    if ( !( m_enuOpenMode & mEFileOpenMode_Read ) )
    {
        MI_ERROR( mCStreamError, EFileNotOpen, "File is not open for reading operations." );
        return mEResult_False;
    }
    if ( Tell() == GetSize() )
    {
        MI_ERROR( mCStreamError, ESizeExceeded, "File size exceeded when reading binary data." );
        return mEResult_False;
    }
    MILPCChar const pcText = m_arrBuffer.GetBuffer() + m_uOffset;
    MIUInt const uSize = static_cast< MIUInt >( g_strlen( pcText ) );
    a_strDest.SetText( pcText, uSize );
    m_uOffset += uSize;
    if ( m_uOffset == m_arrBuffer.GetCount() )
    {
        if ( Tell() == GetSize() )
            return mEResult_Ok;
        Buffer( Tell() );
        mCString strTemp;
        Read( strTemp );
        a_strDest.Append( strTemp );
    }
    else
    {
        m_uOffset += 1;
    }
    return mEResult_Ok;
}
开发者ID:wojtek109,项目名称:rmtools,代码行数:32,代码来源:mi_filestream.cpp

示例7: g_memcpy

mEResult mCFileStream::Read( MILPVoid a_pDest, MIUInt a_uSize )
{
    if ( m_uOffset + a_uSize <= m_arrBuffer.GetCount() )
    {
        g_memcpy( a_pDest, ( m_arrBuffer.GetBuffer() + m_uOffset ), a_uSize );
        m_uOffset += a_uSize;
        return mEResult_Ok;
    }
    if ( !( m_enuOpenMode & mEFileOpenMode_Read ) )
    {
        MI_ERROR( mCStreamError, EFileNotOpen, "File is not open for reading operations." );
        return mEResult_False;
    }
    if ( ( Tell() + a_uSize ) > GetSize() )
    {
        MI_ERROR( mCStreamError, ESizeExceeded, "File size exceeded when reading binary data." );
        return mEResult_False;
    }
    MIByte * pDest = static_cast< MIByte * >( a_pDest );
    for ( ; ; )
    {
        MIUInt const uSize = g_min( a_uSize, ( m_arrBuffer.GetCount() - m_uOffset ) );
        g_memcpy( pDest, ( m_arrBuffer.GetBuffer() + m_uOffset ), uSize );
        pDest += uSize;
        a_uSize -= uSize;
        m_uOffset += uSize;
        if ( !a_uSize )
            break;
        Buffer( Tell() );
    }
    return mEResult_Ok;
}
开发者ID:wojtek109,项目名称:rmtools,代码行数:32,代码来源:mi_filestream.cpp

示例8: memcpy

u32 vfsStreamMemory::Read(void* dst, u32 size)
{
	if(!Memory.IsGoodAddr(m_addr + Tell(), size)) return 0;

	memcpy(dst, &Memory[m_addr + Tell()], size);

	return vfsStream::Read(dst, size);
}
开发者ID:BasCreator,项目名称:rpcs3,代码行数:8,代码来源:vfsStreamMemory.cpp

示例9: GetSize

			virtual int GetSize( )
			{
				int curpos = Tell( );
				Seek( 0, SeekOrigin::END );
				int size = Tell( );
				Seek( curpos, SeekOrigin::SET );
				return size;
			};
开发者ID:brett19,项目名称:Ikarus,代码行数:8,代码来源:FileSystem.hpp

示例10: Tell

size_t BinaryReader::GetSize()
{
    size_t now = Tell();
    Seek(0,SEEK_END);
    size_t size = Tell();
    Seek(now,SEEK_SET);
    return size;
}
开发者ID:EddieRingle,项目名称:cerberus,代码行数:8,代码来源:binary_stream_readers.cpp

示例11: Tell

int64 IFileHandle::Size()
{
	int64 Current = Tell();
	SeekFromEnd();
	int64 Result = Tell();
	Seek(Current);
	return Result;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:8,代码来源:GenericPlatformFile.cpp

示例12: Tell

int sprawl::filesystem::File::FileSize()
{
	int current = Tell();
	Seek(0, RelativeTo::End);
	int size = Tell();
	Seek(current, RelativeTo::Beginning);
	return size;
}
开发者ID:ShadauxCat,项目名称:Sprawl,代码行数:8,代码来源:filesystem.cpp

示例13: Seek

int XFile::GetLength()
{
	if(m_file==XNULL) return 0;
	int v=Tell();
	Seek(0,XSEEK_END);
	int l=Tell();
	Seek(v,XSEEK_SET);
	return l;
}
开发者ID:hgl888,项目名称:nashtest,代码行数:9,代码来源:XFile.cpp

示例14: Tell

u64 vfsStream::GetSize()
{
	u64 last_pos = Tell();
	Seek(0, vfsSeekEnd);
	u64 size = Tell();
	Seek(last_pos, vfsSeekSet);

	return size;
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:9,代码来源:vfsStream.cpp

示例15: ASSERT

size_t DiskFile::GetFileSize()
{
	ASSERT(IsOpen());
	size_t currentPos = Tell();
	Seek(0, FILESEEK_END);
	size_t filesize = Tell();
	Seek(currentPos, FILESEEK_BEGINNING);
	return filesize;
}
开发者ID:gered,项目名称:MyGameFramework,代码行数:9,代码来源:diskfile.cpp


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