Boost logo

Boost :

Subject: Re: [boost] Interest in simple unformatted binary stream I/O?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-04-24 18:22:49


On 04/24/2011 12:18 PM, Vicente BOTET wrote:
> I guess that we can not mix binary and non binary formats. How a binary stream woks for non binary codes?
> I don·t know if a manipulator that changes the mode globaly can be defined so the following will work
> f << bin << x1 << x2; // write 4+4 bytes
> f.seekg(0);
> f >> bin >> y1 >> y2; // read 4+4 bytes

You'd have to replace the num_put facet.
Anyway, I don't think a "bin" manipulator
is a good idea. If I saw it without already
knowing what it meant, I would probably
assume that it set the base, like std::dec,
std::hex, and std::oct.

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at