Let’s say I’m making a game where text can be displayed and scrolled/okay’d when ENTER is pressed.
Is it a good idea to use a output stream class and send my “raw” std::string to it? I’m thinking about doing this so it’d be easier to either send the messages to the console or to the actual screen using an fancy display style
thanks
There’s nothing stopping you from making your own stream buffer class that can then forward to
std::coutor do something more exotic at a later point in time.I suggest reading this article here http://spec.winprog.org/streams/ about iostreams and rolling your own using what is provided to you. Read this to gain an understanding of what is going on.
The Boost IO stream libraries make it even easier for you to create your own streams:
http://www.boost.org/doc/libs/1_43_0/libs/iostreams/doc/index.html