本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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();
}
示例5: ClampedTell
float ClampedTell ()
{
float offset = Tell ().cast<float> ();
if (looped) return fmod (offset, duration);
else return offset < duration ? Tell ().cast<float> () : duration;
}
示例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;
}
示例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;
}
示例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);
}
示例9: GetSize
virtual int GetSize( )
{
int curpos = Tell( );
Seek( 0, SeekOrigin::END );
int size = Tell( );
Seek( curpos, SeekOrigin::SET );
return size;
};
示例10: Tell
size_t BinaryReader::GetSize()
{
size_t now = Tell();
Seek(0,SEEK_END);
size_t size = Tell();
Seek(now,SEEK_SET);
return size;
}
示例11: Tell
int64 IFileHandle::Size()
{
int64 Current = Tell();
SeekFromEnd();
int64 Result = Tell();
Seek(Current);
return Result;
}
示例12: Tell
int sprawl::filesystem::File::FileSize()
{
int current = Tell();
Seek(0, RelativeTo::End);
int size = Tell();
Seek(current, RelativeTo::Beginning);
return size;
}
示例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;
}
示例14: Tell
u64 vfsStream::GetSize()
{
u64 last_pos = Tell();
Seek(0, vfsSeekEnd);
u64 size = Tell();
Seek(last_pos, vfsSeekSet);
return size;
}
示例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;
}