Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact and

Moderators: larsivi

Posted: 08/13/07 19:54:26

Hi! I used Writer to write into the buffer. It works fine with byte, char, int and any other types. But when I wanted to write a char[] Writer puts garbage on it! So I used Buffer.append for char[]. Is it a bug? Try it please. Oh.. I occured it when the buffer was linked with SocketConduit?, and writter was linked with buffer. When using a mem-only buffer there is no problem like this.

Author Message

Posted: 08/15/07 02:34:09

Writer/Reader classes are classified as 'protocols', meaning they need to be able to read what was written. To accommodate this need, arrays are prefixed with their length as a 4-byte integer. That's probably what you're seeing?