Instruction Manual

Click on the banner to return to the user guide home page.
©Copyright 1996 Rogue Wave Software
Return Type of operator>>()
An extremely common mistake is to forget that the functions:
Rwvistream& operator>>(RWvistream&, RWCollectable*&);
RWFile& operator>>(RWFile&, RWCollectable*&);
return their results off the heap. This can result in a memory leak like the following:
main(){
RWCollectableString* string = new RWCollectableString;
RWFile file("mydata.dat");
// WRONG:
file >> string; // Memory leak!
// RIGHT:
delete string;
file >> string;
}