Read/write structs in streams (Tango, and Strings)
Steven Schveighoffer
schveiguy at yahoo.com
Wed Oct 22 07:24:14 PDT 2008
"Robert Kosek" wrote
> Robert Kosek Wrote:
>
>> Hello again folks,
>
> I know I asked a really basic question, but I haven't found a real answer
> either in the Tango documentation or the D language documentation either.
> This makes it really tough to know how I can save structures to a stream
> for later use.
>
> Can someone please tell me if I can read/write structures with dynamic
> length strings from/to a stream? And if not, then how can I read and
> write a string to the stream (without the helper stream class)?
I am not completely knowledgable in the stream classes of Tango that do
serialization, but I don't think there's anything to do what you want. It
would be difficult for the stream class to know the exact layout of your
struct, so how would it know when to output strings? I think DataStream is
what you are looking for, but it will only output a block of data.
Again, not completely knowledgable. You might try asking on the Tango
forums to get the attention of some of the Tango devs that don't pay
attention to the NG.
-Steve
More information about the Digitalmars-d-learn
mailing list