Проблема с std::ostrstream
От: Gatwick  
Дата: 24.09.03 09:28
Оценка:
#include "stdafx.h"


#include <string>
#include <strstream>
#include <iomanip>
#include <iostream>

using namespace std;


int main(int argc, char* argv[])
{
    std::string strTableID;
    std::ostrstream ssBuf;
    ssBuf << 1;
    ssBuf << ends;
    strTableID = ssBuf.str();
    ssBuf.clear();
    ssBuf.flush();
    cout << strTableID << endl;

    ssBuf << 2;
    ssBuf << ends;
    strTableID = ssBuf.str();
    ssBuf.flush();
    ssBuf.clear();
    cout << strTableID << endl;

    return 0;
}

Почему выдает 
1
1

а не

1
2

?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.