Beispiel #1
0
inline stream_offset position_to_offset(std::streampos pos)
{
    // Use implementation-specific member function seekpos().
    return fpos_t_to_offset(pos.seekpos()) +
           stream_offset(std::streamoff(pos)) -
           stream_offset(std::streamoff(pos.seekpos()));
}
// Extracts the member _Fpos from a std::fpos
inline std::fpos_t streampos_to_fpos_t(std::streampos pos)
{
#  if defined (_CPPLIB_VER) || defined(__IBMCPP__)
    return pos.seekpos();
#  else
    return pos.get_fpos_t();
#  endif
}
inline OSGA_Archive::pos_type ARCHIVE_POS( const std::streampos & pos )
{
#if defined(_CPPLIB_VER)//newer Dinkumware(eg: one included with VC++ 2003,2005)
    fpos_t position = pos.seekpos();
#else // older Dinkumware (eg: one included in Win Server 2003 Platform SDK )
    fpos_t position = pos.get_fpos_t();
#endif
    std::streamoff offset = pos.operator std::streamoff( ) - _FPOSOFF( position );

    return OSGA_Archive::pos_type( position + offset );
}