stringstream question
From: Marc Schellens (m_schellens_at_hotmail.com)
Date: 11/04/03
- Next message: Ron Natalie: "Re: Help! dynamic classes (shapeshifter)"
- Previous message: Timothy Stark: "Help! dynamic classes (shapeshifter)"
- Next in thread: Grzegorz Sakrejda: "Re: stringstream question"
- Reply: Grzegorz Sakrejda: "Re: stringstream question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 04 Nov 2003 12:03:48 +0900
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
- Next message: Ron Natalie: "Re: Help! dynamic classes (shapeshifter)"
- Previous message: Timothy Stark: "Help! dynamic classes (shapeshifter)"
- Next in thread: Grzegorz Sakrejda: "Re: stringstream question"
- Reply: Grzegorz Sakrejda: "Re: stringstream question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|