How to switch iostream from binary to text mode and vice versa?
Posted
by Mad Fish
on Stack Overflow
See other posts from Stack Overflow
or by Mad Fish
Published on 2010-03-16T19:59:14Z
Indexed on
2010/03/16
20:01 UTC
Read the original article
Hit count: 211
I want to read both formatted text and binary data from the same iostream. How can I do that?
Why? Imagine this situation: You have different resources, and resource loaders for them, that take a std::istream as a parameter. And there are a "resource source" that provides these streams. Resources can be both text and binary and I need to handle both cases with resource loaders.
Or other situation: Image that you have an archive with resources of mixed types. How can I get a text stream from inside the binary archive stream?
© Stack Overflow or respective owner