Creating an iostream

Started by
3 comments, last by Kekko 19 years, 7 months ago
How do I declare an iostream? All I get is a C2512 saying there's no appropriate constructor for the class. Only the fstreams work.
Advertisement
Clicky

What sort of iostream do you want? Use fstreams to handle files, cout to sent to the console, streamstreams for strings, etc. It all depends on what you want to do.
Quote:Original post by Kekko
How do I declare an iostream? All I get is a C2512 saying there's no appropriate constructor for the class. Only the fstreams work.

You're trying to inherit from iostream aren't you, well you need to pass it a std::streambuf* using a constructor specifier.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Right, ostream has no default contructor.
Aha! Found out about stringstreams. That was exactly what I wanted to use...

This topic is closed to new replies.

Advertisement