Your question is a bit vague but the code example makes it clearer.
You have two choices:
First, initialze ostringstream through construction (construct another instance in each step of the loop):
for(int i = 0; i < 10; ++i) {
value = rand() % 100 ;
ostringstream os;
os << value;
cout << os.str() << " " << os << endl;
ntree->insert(os.str());
//i want my os object to initializ it here
}
Second, reset the internal buffer and clear the stream state (error state, eof flag, etc):
for(int i = 0; i < 10; ++i) {
value = rand() % 100 ;
os << value;
cout << os.str() << " " << os << endl;
ntree->insert(os.str());
//i want my os object to initializ it here
os.str("");
os.clear();
}