M
Marc Schellens
class myClass
{
stringstream ioss;
istream* is;
void f()
{
....
string initStr("");
ioss.str( initStr);
ioss.seekg( 0);
ioss.clear();
is->get( *ioss.rdbuf());
.....
}
public:
myClass( istream* is_): ioss(), is( is_) {}
....
};
works well, but:
void f()
{
....
// string initStr("");
ioss.str( ""); // HERE
ioss.seekg( 0);
ioss.clear();
is->get( *ioss.rdbuf());
.....
}
causes the program reproducible to fail.
Is there something obvious wrong? (compiles without warning)
Is there a easier/better/clearer way to reset a stringstream?
thanks,
marc
{
stringstream ioss;
istream* is;
void f()
{
....
string initStr("");
ioss.str( initStr);
ioss.seekg( 0);
ioss.clear();
is->get( *ioss.rdbuf());
.....
}
public:
myClass( istream* is_): ioss(), is( is_) {}
....
};
works well, but:
void f()
{
....
// string initStr("");
ioss.str( ""); // HERE
ioss.seekg( 0);
ioss.clear();
is->get( *ioss.rdbuf());
.....
}
causes the program reproducible to fail.
Is there something obvious wrong? (compiles without warning)
Is there a easier/better/clearer way to reset a stringstream?
thanks,
marc