Florian Dietz <floriandiet
...@googlemail.com> writes:
> Am Freitag, 26. Oktober 2012 13:07:09 UTC+2 schrieb Zach Beane:
>> Florian Dietz <floriandiet
...@googlemail.com> writes:
>> > I am writing a serializer for some objects and I can't seem to be able
>> > to write and read both bytes and strings to the file. It's an
>> > either-or question, depending on what type of stream I take.
>> > Am I overlooking something? What is the best way to do this?
>> There is no standard way. Many implementations support "bivalent
>> streams" that can take both binary and character operations. In the
>> absence of bivalent streams, it's typical to use a binary stream (with
>> an element type of (unsigned-byte 8)) and convert characters and strings
>> to the appropriately encoded octet vector before writing them to the
>> stream.
>> Zach
> Thanks, I went with this and wrote some macros.
Frodef's suggestion is good, too. Flexi-streams are handy.