#118 ostringstream::seekp(0, ios::beg) wrong

closed-works-for-me
5
2007-01-29
2007-01-29
Jin Qing
No

ostringstream::seekp(0, ios::beg) can not seek to the begin.
ostringstream::seekp(0) is correct.

Following codes assert fail:
(VC6, stlport-5.1.0)

#include <sstream>
#include <iostream>
#include <string>
#include <cassert>

using namespace std;

int main()
{
ostringstream oss;

oss << "012345";
// oss.seekp(0); // RIGHT
oss.seekp(0, ios::beg); // WRONG
oss << "X";
assert("X12345" == oss.str());

return 0;
}

Discussion

  • Petr Ovtchenkov

    Petr Ovtchenkov - 2007-01-29
    • assigned_to: nobody --> complement
    • status: open --> closed-works-for-me
     
  • Petr Ovtchenkov

    Petr Ovtchenkov - 2007-01-29

    Logged In: YES
    user_id=615813
    Originator: NO

    As oss.seekp(0) as oss.seekp(0, ios::beg ) are correct, see standard.

    Both pass through test, that I just added to trunk. If tests fail in you case, resubmit bug. (Note: I check this in trunk).

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks