Function SetSize

Synopsis

#include <include/cstdoutstream.hpp>

STDMETHOD() SetSize(uint64_t newSize)

Description

No description yet.

Source

Lines 85-97 in src/cstdoutstream.cpp. Line 24 in include/cstdoutstream.hpp.

STDMETHODIMP CStdOutStream::SetSize( uint64_t newSize ) {
    const auto old_pos = mOutputStream.tellp();
    mOutputStream.seekp( 0, ostream::end );

    const auto diff_pos = newSize - mOutputStream.tellp();
    if ( diff_pos > 0 ) {
        std::fill_n( std::ostream_iterator< char >( mOutputStream ), diff_pos, '\0' );
    }

    mOutputStream.seekp( old_pos );

    return mOutputStream ? S_OK : E_FAIL;
}





Add Discussion as Guest

Log in